Tuesday, March 8, 2011

Check Network Connection Command


You need to use any one of the following tool or command under Linux to check network connections including their state, source/destination, and addresses and bandwidth usage etc..

  1. ss command: It dump socket (network connection) statistics such as all TCP / UDP connections, established connection per protocol (e.g., display all established ssh connections), display all the tcp sockets in various state such as ESTABLISHED or FIN-WAIT-1 and so on.
  2. netstat command: It can display network connections, routing tables, interfaces and much more
  3. tcptrack and iftop commands: Displays information about TCP connections it sees on a network interface and display bandwidth usage on an interface by host respectively.

    Display Currently Established, Closed, Orphaned and Waiting TCP sockets, enter:

    # ss -s

    Sample outputs:

    Total: 529 (kernel 726)
    TCP:   1403 (estab 286, closed 1099, orphaned 1, synrecv 0, timewait 1098/0), ports 774
    
    Transport Total     IP        IPv6
    *   726       -         -
    RAW   0         0         0
    UDP   27        13        14
    TCP   304       298       6
    INET   331       311       20
    FRAG   0         0         0
    
    
    Or you can use the netstat command as follows:
    
    # netstat -s 
     

    Display All Open Network Ports

    Use the ss command as follows:
    # ss -l
     

No comments:

Post a Comment