Test TCP connectivity with curl
With the older version: # curl -version curl 7.21.0 (x8664-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6 Protocols: dict file ftp ftps http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz It works: # curl -v 2a02:1788:4fd. Happily, this sort of 'ad-hoc' request-pinning is possible via command-line with cURL, which provides a special resolve option, formatted -resolve DOMAIN:PORT:IP, that routes all web requests performed during the execution of a cURL command that match a given DOMAIN and PORT to a specified IP address. The values specified by this.
You probably know about curl command: it’s great for downloading web pages or files from a Unix command line. But there’s another great usage curl command has: testing TCP ports connectivity.
Say, you’re helping with some firewall changes and need to confirm that connection from your server to some remote host and specific TCP port still works.
Here’s how you can do it using curl command and its telnet functionality.
Test SSH port connection with curl
In this example, SSH connection works because:
- We get the “Connected” status
- We see the SSH version prompt: SSH-2.0-OpenSSH_7.4
Test jBoss port 8080 with curl
Curl Ipv6 With Port
This scenario shows that connection is refused (probably because there’s no service running on that port).
Curl Ipv6 Link Local
IMPORTANT: you would probably get a different message if firewall blocks the 8080 port. Connection refused is a clear sign that port is accessible, but nothing’s responding on it.
Curl Ipv6 Connection Refused
See Also
- Using wget and curl
- iptables: keep rules after reboot
Curl Ipv6 Invalid Argument
