4

I often use the ping command to check if a website is available or not, or if I can access a machine, so basically mostly for diagnostics, and what would be really useful is if I could specify which port(s) those ICMP echoes go to, is there any way of doing this with ping, or another tool which would allow for me to easily do this without having to generate packets manually?

An option for instance would be to create a custom ICMP packet set to go to a specific port, and then I could use bittwist to send it, and Wireshark to monitor if I am getting anything in return, but this seems a bit of a hassle to do every time, so I was wondering if there is an easier route?

  • 3
    There is no concept of "port" in ICMP. If you want to reach a TCP or UDP port, use netcat. – Jos Jun 24 '15 at 12:30
  • you can try with TCPPing or smokeping tools... – Geo Hurling Feb 16 '18 at 13:03
6

IIRC you cannot send a "ping" packet to a specific port.

On a port, there is a "software" listening. This software will implement it's own protocol - HTTP, SMTP, FTP, or even some own protocol.

Those servers won't respond to an ICMP packet. ICMP packets need to be sent to the ICMP port.

However, you may just try to open a TCP connection (telnet host 12345) and see if the connection is successfully.

0

Here is an example of how to ping a specific IP-port on your network:

  1. Download and install nMap.
  2. Run ifconfig -a to identify your network topology; the terminal output should display the host IP-address traced to your command-line, displayed after "inet" (e.g. inet: 10.0.0.2).
  3. Now open the nMap tool to scan your network by running nmap -sP network-ip-address topology/24 (e.g. nmap -sP 10.0.0.1/24); that should display all hosts connected to the network.
  4. Locate the host IP-address of the port you wish to ping; for example, if your network is hosting a VPN server on a router at IP address 10.0.0.233. First, try to ping the address by running nmap -sn host-ip-address (eg nmap -sn 10.0.0.233)- the terminal output should return a report that the server is either up or down.
  5. However, sometimes a host may only be visible or identifiable if you ping a specific port by running nmap -Pn port-number ip-address; for example, the subject router may only be traceable if we ping a specific port on the router- in this case UDP port 1143 for OpenVPN (e.g. nmap -Pn 1143 10.0.0.233). The aforementioned command should confirm that the port is open within the terminal output, even if the host is ostensibly down according to the initial run of the nmap port-scan.

Hope that helps- it helped me!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy