Ping a Specific Port of a Host

Summary

In this post, I will introduce how to “ping” a specific port in a host.

Details

Usually to test the connectivity, we will use the command ping. However, ping will typically send ICMP ECHO_REQUEST packets to network hosts. In ICMP, there are no ports. But in many cases (especially when we have a server and wanner refactor the firewall options), we want to know that a port is open, closed, or filtered.

Luckily we have the powerful tool nmap, which works cross platform. We can easily download it by apt-get or brew.

We present typical examples below.

FighterNandeMBP:~$ nmap 116.85.33.228 -p 22
Starting Nmap 7.70 ( https://nmap.org ) at 2019-01-12 23:33 PST
Nmap scan report for 116.85.33.228
Host is up (0.34s latency).

PORT   STATE SERVICE
22/tcp open  ssh

Nmap done: 1 IP address (1 host up) scanned in 0.90 seconds
FighterNandeMBP:~$ nmap 116.85.33.228 -p 3306
Starting Nmap 7.70 ( https://nmap.org ) at 2019-01-12 23:34 PST
Nmap scan report for 116.85.33.228
Host is up (0.32s latency).

PORT     STATE SERVICE
3306/tcp open  mysql

Nmap done: 1 IP address (1 host up) scanned in 3.28 seconds

Leave a Reply

Your email address will not be published. Required fields are marked *