centos7查看路由的命令_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                          :::*

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值