0
点赞
收藏
分享

微信扫一扫

Centos Linux查看网络连接

曾宝月 2024-10-01 阅读 14
Linux运维

方法一:使用netstat命令(需要net-tools包)

[root@sre01 ~]# netstat -tan
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:234             0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 192.168.236.100:22      192.168.236.1:59783     ESTABLISHED
tcp        0      0 192.168.236.100:22      192.168.236.1:64133     ESTABLISHED
tcp        0      0 192.168.236.100:22      192.168.236.1:65122     ESTABLISHED
tcp        0      0 192.168.236.100:22      192.168.236.1:63730     ESTABLISHED
tcp6       0      0 ::1:25                  :::*                    LISTEN     
tcp6       0      0 :::234                  :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN  


[root@sre01 ~]# netstat -lntp
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:25            0.0.0.0:*               LISTEN      1314/master         
tcp        0      0 0.0.0.0:234             0.0.0.0:*               LISTEN      6184/nc             
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1164/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      1314/master         
tcp6       0      0 :::234                  :::*                    LISTEN      6184/nc             
tcp6       0      0 :::22                   :::*                    LISTEN      1164/sshd           


[root@sre01 ~]# netstat -lnup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
udp        0      0 0.0.0.0:68              0.0.0.0:*                           3340/dhclient       
[root@sre01 ~]# netstat -lnap
Active Internet connections (servers and established)


方法二:使用ss命令

[root@sre01 ~]# ss -lnt
State       Recv-Q Send-Q                         Local Address:Port                                        Peer Address:Port              
LISTEN      0      100                                127.0.0.1:25                                                     *:*                  
LISTEN      0      10                                         *:234                                                    *:*                  
LISTEN      0      128                                        *:22                                                     *:*                  
LISTEN      0      100                                    [::1]:25                                                  [::]:*                  
LISTEN      0      10                                      [::]:234                                                 [::]:*                  
LISTEN      0      128                                     [::]:22                                                  [::]:*                  

[root@sre01 ~]# ss -lnu
State       Recv-Q Send-Q                         Local Address:Port                                        Peer Address:Port              
UNCONN      0      0                                          *:68                                                     *:*     


举报

相关推荐

0 条评论