Thursday, 21 July 2016

How to check which ports are opened and listening ?


$ netstat -aon | more
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       Timer
tcp        0      0 10.170.208.95:8105          0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:8009                0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:61196               0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:8109                0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:4750                0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:56271               0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:8082                0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:2738                0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:8085                0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 10.170.208.95:8000          0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:49729               0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 0.0.0.0:28002               0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 127.0.0.1:54051             0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 10.170.208.95:8085          10.239.199.158:57189        ESTABLISHED off (0.00/0/0)
tcp        0      0 10.170.208.95:8085          10.241.105.45:62267         ESTABLISHED off (0.00/0/0)
tcp        1      0 10.170.208.95:8085          10.238.168.119:50496        CLOSE_WAIT  off (0.00/0/0)



$ netstat -plnt
(No info could be read for "-p": geteuid()=249 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 10.170.208.95:8105          0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:8009                0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:61196               0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:8109                0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:4750                0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:56271               0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:8082                0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:2738                0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:8085                0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      -
tcp        0      0 10.170.208.95:8000          0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:49729               0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:28002               0.0.0.0:*                   LISTEN      -
tcp        0      0 127.0.0.1:54051             0.0.0.0:*                   LISTEN      -



$ netstat -vatn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 10.170.208.95:8105          0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:8009                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:61196               0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:8109                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:4750                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:56271               0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:8082                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:2738                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:8085                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN
tcp        0      0 10.170.208.95:8000          0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:49729               0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:28002               0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:54051             0.0.0.0:*                   LISTEN
tcp        0      0 10.170.208.95:8085          10.239.199.158:57189        ESTABLISHED
tcp        0      0 10.170.208.95:8085          10.241.105.45:62267         ESTABLISHED
tcp        1      0 10.170.208.95:8085          10.238.168.119:50496        CLOSE_WAIT

No comments:

Post a Comment

Note: only a member of this blog may post a comment.