2019/08/30

Use netstat to find out specific port listened by which process.


 First look at the syntax of netstate.
BusyBox v1.25.1 (2019-08-07 15:22:35 CST) multi-call binary.
Usage: netstat [-ral] [-tuwx] [-enWp]
Display networking information
-r Routing table
-a All sockets
-l Listening sockets
Else: connected sockets
-t TCP sockets
-u UDP sockets
-w Raw sockets
-x Unix sockets
Else: all socket types
-e Other/more information
-n Don't resolve names
-W Wide display
-p Show PID/program name for sockets

I want to know which port softethervpn listens to.
Execute command: netstat -alnp | grep vpnserver
root@AtopTechnologies:~# netstat -alnp | grep vpnserver
udp        0      0 0.0.0.0:33147           0.0.0.0:*                           4007/vpnserver
udp        0      0 192.168.5.143:1194      0.0.0.0:*                           4007/vpnserver
udp        0      0 127.0.0.1:1194          0.0.0.0:*                           4007/vpnserver
udp        0      0 192.168.1.1:1194        0.0.0.0:*                           4007/vpnserver
udp        0      0 0.0.0.0:63972           0.0.0.0:*                           4007/vpnserver
udp        0      0 ::1:1194                :::*                                4007/vpnserver
udp        0      0 fe80::8ee7:48ff:fe00:1:1194 :::*                                4007/vpnserver
udp        0      0 fe80::8ee7:48ff:fe00:0:1194 :::*                                4007/vpnserver
It is listen UDP port 1194, same as openVPN.