CentOS7路由、端口和服务排障常用命令

1. ip route   显示主机基本路由信息

~]# ip route

default via 172.25.0.254 dev eth0  proto static  metric 1024 

172.25.0.0/24 dev eth0  proto kernel  scope link  src 172.25.0.11 

172.25.253.254 via 172.25.0.254 dev eth0  proto static  metric 1

2. traceroute  /  tracepath   追踪远程主机UDP数据包路径

traceroute 默认追踪UDP数据包,选项 -I 可追踪 ICMP的数据包,-T可追踪TCP数据包

~]# tracepath www.baidu.com

 1?: [LOCALHOST]                                         pmtu 1500

 1:  gateway                                               4.109ms 

 1:  gateway                                               3.545ms 

 2:  192.168.0.2                                           0.320ms 

 3:  210.206.46.79                                        6.380ms 

 4:  10.255.88.241                                         1.432ms 

 5:  10.255.33.141                                         1.131ms 

 6:  10.255.30.49                                          4.399ms 

 7:  10.255.28.173                                         2.054ms 

 8:  124.205.98.69                                         1.810ms 

 9:  14.197.243.133                                        1.918ms 

10:  14.197.250.170                                        2.636ms 

11:  182.61.253.119                                        3.439ms

 Too many hops: pmtu 1500

     Resume: pmtu 1500

3. ss     与netstat功能相当

ss与netstat 选项

-n  显示接口和端口的编号,且不显示名称

-t  显示TCP套接字

-u  显示TCP套接字

-l  仅显示侦听中的套接字

-a  显示所有套接字,包括侦听中和已经建立的

~]# ss -ta

State       Recv-Q Send-Q Local Address:Port                 Peer Address:Port                

LISTEN      0      128              *:https                          *:*                    

LISTEN      0      5                *:ideafarm-door                  *:*                    

LISTEN      0      5                *:5901                           *:*                    

LISTEN      0      128              *:sunrpc                         *:*                    

LISTEN      0      128              *:6001                           *:*                    

LISTEN      0      128      127.0.0.1:8307                           *:*                    

LISTEN      0      5      192.168.122.1:domain                         *:*                    

LISTEN      0      128              *:ssh                            *:*                    

LISTEN      0      128      127.0.0.1:ipp                            *:*                    

LISTEN      0      100      127.0.0.1:smtp                           *:*                    

ESTAB       0      0      192.168.96.254:ssh                  192.168.101.251:53439                

LISTEN      0      128             :::https                         :::*                    

LISTEN      0      5               :::ideafarm-door                 :::*                    

LISTEN      0      5               :::5901                          :::*                    

LISTEN      0      128             :::sunrpc                        :::*                    

LISTEN      0      128             :::6001                          :::*                    

LISTEN      0      128            ::1:8307                          :::*                    

LISTEN      0      128             :::ssh                           :::*                    

LISTEN      0      128            ::1:ipp                           :::*                    

LISTEN      0      100            ::1:smtp                          :::*

猜你喜欢

转载自www.cnblogs.com/qiyunshe-NSD1805/p/9221414.html