linux下查看路由的命令

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux下查看路由的命令相关的知识,希望对你有一定的参考价值。

  • 使用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

  • 使用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
  • 使用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两个命令使用。

    以上是关于linux下查看路由的命令的主要内容,如果未能解决你的问题,请参考以下文章

    Linux环境下查看网络性能的基本命令

    怎样查看linux下dhcp服务器分配出去的IP地址及剩余IP地址

    linux下永久添加静态路由

    Linux下绝对经典的命令

    路由器的路由配置命令汇总(win和linux系统)

    linux 下 查看ipv6网关