Table des matières

Netstat

Permet de compter l'état des sessions TCP

root@web:~# netstat -an | awk '/tcp/ {print $6}'|sort | uniq -c
    193 CLOSE_WAIT
   1344 ESTABLISHED
     13 FIN_WAIT1
     90 FIN_WAIT2
     27 LAST_ACK
    262 LISTEN
    419 TIME_WAIT

lsof

lsof -i permet d'afficher la liste des sockets ouvertes.
On peux utiliser un lsof -i | egrep 'IPv4|LISTEN'

# lsof -i 
COMMAND     PID     USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
portmap     638   daemon    4u  IPv4    3747      0t0  UDP *:sunrpc 
portmap     638   daemon    5u  IPv4    3748      0t0  TCP *:sunrpc (LISTEN)
sshd        661     root    3u  IPv4    3775      0t0  TCP *:ssh (LISTEN)
sshd        661     root    4u  IPv6    3777      0t0  TCP *:ssh (LISTEN)
avahi-dae   729    avahi   13u  IPv4    3999      0t0  UDP *:mdns 
avahi-dae   729    avahi   14u  IPv4    4000      0t0  UDP *:47590 
rpc.statd   765    statd    6u  IPv4    4124      0t0  UDP *:941 
rpc.statd   765    statd    8u  IPv4    4162      0t0  UDP *:36944 
rpc.statd   765    statd    9u  IPv4    4165      0t0  TCP *:48473 (LISTEN)
cupsd       949     root    5u  IPv6   34381      0t0  TCP localhost:ipp (LISTEN)
cupsd       949     root    6u  IPv4   34382      0t0  TCP localhost:ipp (LISTEN)
transmiss  8928 julinux4   12u  IPv4 1011313      0t0  TCP *:51444 (LISTEN)
transmiss  8928 julinux4   13u  IPv4 1011318      0t0  UDP *:51444 
transmiss  8928 julinux4   14u  IPv6 1011315      0t0  TCP *:51444 (LISTEN)
transmiss  8928 julinux4   26u  IPv4 7941064      0t0  TCP 192.168.1.14:51444->arf62-1-82-237-249-162.fbx.proxad.net:4209 (ESTABLISHED)
ntpd      17496      ntp   16u  IPv4 4327139      0t0  UDP *:ntp 
ntpd      17496      ntp   17u  IPv6 4327140      0t0  UDP *:ntp 
ntpd      17496      ntp   18u  IPv6 4327144      0t0  UDP localhost:ntp 
ntpd      17496      ntp   19u  IPv6 4327145      0t0  UDP [fe80::201:2eff:febc:169d]:ntp 
ntpd      17496      ntp   20u  IPv4 4327146      0t0  UDP localhost:ntp 
ntpd      17496      ntp   21u  IPv4 4327147      0t0  UDP 192.168.1.14:ntp 

ss

ss” est une commande similaire à ”netstat”.

# ss -ntap
State       Recv-Q Send-Q               Local Address:Port                 Peer Address:Port 
LISTEN      0      128                              *:111                             *:*      users:(("portmap",638,5))
LISTEN      0      64                               *:35025                           *:*     
LISTEN      0      128                             :::51444                          :::*      users:(("transmission",8928,14))
LISTEN      0      128                              *:51444                           *:*      users:(("transmission",8928,12))
LISTEN      0      128                             :::22                             :::*      users:(("sshd",661,4))
LISTEN      0      128                              *:22                              *:*      users:(("sshd",661,3))
LISTEN      0      128                      127.0.0.1:631                             *:*      users:(("cupsd",949,6))
LISTEN      0      128                            ::1:631                            :::*      users:(("cupsd",949,5))
LISTEN      0      128                              *:48473                           *:*      users:(("rpc.statd",765,9))
ESTAB       0      0                     192.168.1.14:51444              82.237.249.162:1064   users:(("transmission",8928,33))
ESTAB       0      17396                 192.168.1.14:51444                85.234.196.4:56176  users:(("transmission",8928,29))
SYN-SENT    0      1                     192.168.1.14:51501               82.226.239.62:10156  users:(("transmission",8928,26))
TIME-WAIT   0      0                     192.168.1.14:51444                85.27.51.205:56739 
TIME-WAIT   0      0                     192.168.1.14:48042               213.186.33.19:80    
ESTAB       0      0                     192.168.1.14:689                  192.168.1.99:2049  
ESTAB       0      76956                 192.168.1.14:51444               82.233.90.102:55319  users:(("transmission",8928,34))
ESTAB       0      0                     192.168.1.14:53752               66.196.66.157:80     users:(("firefox-bin",1863,65))
TIME-WAIT   0      0                     192.168.1.14:51167               213.186.33.19:80    
TIME-WAIT   0      0                     192.168.1.14:51444               78.240.186.45:38432 

 
asr/sys/netstat_ss_lsof.txt · Dernière modification: 2016/03/29 23:33 (édition externe)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki