This is a guide for using the nmap tool to troubleshoot port connectivity. Nmap is a powerful port scanning tool that allows you to scan a server's ports and tell you their status.
Nmap is a complex tool with a large number of features. However, for basic port troubleshooting, you can use the following syntax:
nmap --reason -p <ports> <IP address or domain name>
The following example is a nmap command to scan ports 22, 80, 443, and 1234 for cpanel.net:
[ email@example.com  ~]# nmap --reason -p 22,80,443,1234 cpanel.net
Starting Nmap 6.40 ( http://nmap.org ) at 2020-12-17 08:40 CST
Nmap scan report for cpanel.net (188.8.131.52)
Host is up, received echo-reply (0.0011s latency).
Other addresses for cpanel.net (not scanned): 184.108.40.206
PORT STATE SERVICE REASON
22/tcp open ssh syn-ack
80/tcp open http syn-ack
443/tcp open https syn-ack
1234/tcp filtered hotline port-unreach
Nmap done: 1 IP address (1 host up) scanned in 0.50 seconds
The output from this command shows that ports 22, 80, and 443 are open and listening while port 1234 is unreachable.
You can find more information about nmap commands, port states, and other documentation using the sources below: