Troubleshooting With Netstat

Updated on November 21, 2023
Troubleshooting With Netstat header image

netstat (Network Statistics) is useful to query the state of your network connections. It is available for Linux, Windows and MacOS.

Verify your application is listening on the correct port

Run netstat from the console of your server. Useful command switches are:

-u : Show UDP sockets
-p : Show the PID and name of the program to which each socket belongs.
-l : Show only listening sockets.
-n : Show numeric addresses.
-t : Show TCP sockets

Example:

$ netstat -uplnt

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1491/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      1491/sshd
udp        0      0 127.0.0.1:323           0.0.0.0:*                           655/chronyd
udp        0      0 0.0.0.0:68              0.0.0.0:*                           1312/dhclient
udp6       0      0 ::1:323                 :::*                                655/chronyd

Review this information to verify your application is listening on the correct local address and socket. Please provide this information to support if you submit a ticket for further debugging.