Ping a Specific Port
Just a quick sanity check here.
Can you ping a specific port of a machine, and if so, can you provide an example?
I'm looking for something like ping ip address portNum
.
Solution 1:
You can't ping ports, as Ping is using ICMP which doesn't have the concept of ports. Ports belong to the transport layer protocols like TCP and UDP. However, you could use nmap to see whether ports are open or not
nmap -p 80 example.com
Edit: As flokra mentioned, nmap is more than just a ping-for-ports-thingy. It's the security auditers and hackers best friend and comes with tons of cool options. Check the doc for all possible flags.
Solution 2:
Open a telnet session to the specific port, for example:
# telnet google.com 80
Trying 74.125.226.48...
Connected to google.com.
Escape character is '^]'.
To close your session, hit Ctrl+].
Solution 3:
If you're on a windows installation with powershell v4 or newer, you can use the test-netconnection powershell module:
Test-NetConnection <host> -port <port>
Example: Test-NetConnection example.com -port 80
This cmdlet also has the alias tnc
. Eg tnc example.com -port 80