Sharing

2013年8月13日 星期二

Netstat 筆記


Check the LISTEN port of TCP

$ sudo netstat -plnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1199/mysqld     
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      953/smbd        
tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      1191/dovecot    
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      1191/dovecot    
tcp        0      0 127.0.0.1:80            0.0.0.0:*               LISTEN      18249/nginx     
tcp        0      0 10.1.192.180:22         0.0.0.0:*               LISTEN      32423/sshd      
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2140/master     
tcp        0      0 10.1.192.180:443        0.0.0.0:*               LISTEN      18249/nginx     
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      953/smbd        
tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      1191/dovecot    
tcp        0      0 10.1.192.180:5666       0.0.0.0:*               LISTEN      22129/nrpe      
tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      1191/dovecot    
tcp6       0      0 :::139                  :::*                    LISTEN      953/smbd        
tcp6       0      0 :::110                  :::*                    LISTEN      1191/dovecot    
tcp6       0      0 :::143                  :::*                    LISTEN      1191/dovecot    
tcp6       0      0 ::1:25                  :::*                    LISTEN      2140/master     
tcp6       0      0 :::445                  :::*                    LISTEN      953/smbd        
tcp6       0      0 :::993                  :::*                    LISTEN      1191/dovecot    
tcp6       0      0 :::995                  :::*                    LISTEN      1191/dovecot    

看所有現在的 connection
$ netstat -n -a  | grep 8080
tcp        0      0 10.42.92.34:8080        0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:58080         0.0.0.0:*               LISTEN     
tcp        0      0 10.42.92.34:8080        10.42.92.8:51923        ESTABLISHED
tcp        0      0 10.42.92.34:8080        10.42.92.8:1896         ESTABLISHED
tcp        0      0 10.42.92.34:8080        10.42.92.8:63793        ESTABLISHED
tcp        0      0 10.42.92.34:8080        10.42.92.8:30276        ESTABLISHED
tcp        0      0 10.42.92.34:8080        10.42.92.8:47118        TIME_WAIT  
tcp        0      0 10.42.92.34:8080        10.42.92.8:29695        TIME_WAIT  
tcp        0      0 10.42.92.34:8080        10.42.92.8:4093         TIME_WAIT  
tcp        0      0 10.42.92.34:8080        10.42.92.8:37087        TIME_WAIT  
tcp        0      0 10.42.92.34:8080        10.42.92.201:50008      TIME_WAIT  

查 host name
$ host <ip>
$ nslookup <ip>
$ dig -x <ip>
$ arp -a | grep <ip>



沒有留言: