linux下查看路由的命令

半腔热情 提交于 2020-04-08 08:56:51
  1. 使用netstat -r命令显示路由表
    [root@centos2 network-scripts]# netstat -r
    Kernel IP routing table
    Destination Gateway Genmask Flags MSS Window irtt Iface
    default gateway 0.0.0.0 UG 0 0 0 ens33
    192.168.58.0 0.0.0.0 255.255.255.0 U 0 0 0 ens33
    192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0

  2. 使用route -n命令
    [root@centos2 network-scripts]# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    0.0.0.0 192.168.58.254 0.0.0.0 UG 100 0 0 ens33
    192.168.58.0 0.0.0.0 255.255.255.0 U 100 0 0 ens33
    192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
  3. 使用ip route命令
    [root@centos2 network-scripts]# ip route
    default via 192.168.58.254 dev ens33 proto dhcp metric 100
    192.168.58.0/24 dev ens33 proto kernel scope link src 192.168.58.149 metric 100
    192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1

以上三个命令都可以显示主机的路由表信息。

在windows中,显示路由route print; netstat -r两个命令使用。

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!