netstat este o comandă UNIX care tipărește conexiunile de rețea, tabela de routare, și un număr de statistici. Este disponibilă de asemenea sub DOS sau Windows sub forma unui program independent.

Sintaxă modificare

netstat [opțiuni]

O scurtă listă a parametrilor comenzii este după cum urmează:

  • -a - tipărește toate conexiunile active (în engleză all)
  • -c - tipărește în mod continuu, datele pe ecran sunt actualizate odată pe secundă
  • -i - tipărește datele relevante pentru interfața specificată
  • -n - tipărește date numerice cum ar fi adrese de IP în loc de hostname
  • -r - tipărește tabela de routare
  • -s - tipărește date statistice
  • --tcp - tipărește toate datele referitoare la protocolul TCP
  • --udp - tipărește toate datele referitoare la protocolul UDP


Exemple modificare

Toate de exemple de mai jos provin de pe un calculator Linux.

Conexiunile de rețea modificare

$ netstat -a --tcp --udp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State      
tcp        0      0 localhost.localdomain:ipp   *:*                         LISTEN      
tcp        0      0 localhost.localdomain:smtp  *:*                         LISTEN      
tcp        0      0 localhost6.localdomain6:ipp *:*                         LISTEN      
udp        0      0 *:ipp                       *:*                                     
udp        0      0 *:bootpc                    *:*                                     
udp        0      0 *:mdns                      *:*                                     
udp        0      0 *:36202                     *:*                                     

Tabela de routare modificare

$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.254.0   0.0.0.0         255.255.255.0   U         0 0          0 eth7
0.0.0.0         192.168.254.254 0.0.0.0         UG        0 0          0 eth7

Interfețe modificare

$ netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth7       1500   0    32165      0      0      0    23421      0      0      0 BMRU
lo        16436   0      199      0      0      0      199      0      0      0 LRU

Statistici privind pachetele modificare

$ netstat -s --tcp
IcmpMsg:
   InType3: 13
   InType8: 2
   OutType0: 2
   OutType3: 21
   OutType8: 20
Tcp:
   546 active connections openings
   5 passive connection openings
   34 failed connection attempts
   19 connection resets received
   0 connections established
   30016 segments received
   20868 segments send out
   280 segments retransmited
   0 bad segments received.
   223 resets sent
UdpLite:
TcpExt:
   38 TCP sockets finished time wait in fast timer
   608 delayed acks sent
   Quick ack mode was activated 166 times
   22363 packets header predicted
   2392 acknowledgments not containing data received
   54 predicted acknowledgments
   3 times recovered from packet loss due to SACK data
   3 congestion windows fully recovered
   2 congestion windows partially recovered using Hoe heuristic
   TCPDSACKUndo: 59
   76 congestion windows recovered after partial ack
   0 TCP data loss events
   26 timeouts after SACK recovery
   1 timeouts in loss state
   5 fast retransmits
   211 other TCP timeouts
   163 DSACKs sent for old packets
   120 DSACKs received
   19 connections reset due to unexpected data
   4 connections reset due to early user close
   2 connections aborted due to timeout
   TCPDSACKIgnoredOld: 24
   TCPDSACKIgnoredNoUndo: 12
   TCPSackShifted: 2
   TCPSackMerged: 19
   TCPSackShiftFallback: 55
IpExt:
   InMcastPkts: 22
   OutMcastPkts: 26
   InOctets: 36104049
   OutOctets: 2130532
   InMcastOctets: 6184
   OutMcastOctets: 6344


Legături externe modificare


 v  d  m  Programe în linia de comandă pentru Unix (mai multe)
Management de fișiere: cat | cd | chmod | chown | chgrp | cksum | cmp | cp | du | df | file | fsck | ln | ls | lsof | mkdir | mount | mv | pwd | rm | rmdir | split | touch
Management de procese: at | chroot | cron | exit | kill | killall | nice | pgrep | pidof | pkill | ps | pstree | sleep | time | top | wait
Management utilizator/mediu: env | finger | id | mesg | passwd | su | sudo | uname | uptime | w | wall | who | whoami | write
Procesare text: awk | comm | cut | ed | ex | fmt | head | iconv | join | less | more | paste | sed | sort | tac | tail | tr | uniq | wc | xargs
Programare Shell: basename | echo | expr | false | printf | test | true | unset Imprimare:
lp
Communicații:
inetd | netstat | ping | rlogin | traceroute
Căutare:
find | grep | strings
Diverse:
banner | bc | cal | dd | man | size | yes