跳转至

查看路由规则

在三层交换机上查看路由配置,具体步骤因厂商和操作系统(如华为、思科、H3C等)而异,但一般可以通过以下通用方法查看:

1. 登录交换机

使用终端工具(如SecureCRT、PuTTY)通过SSH或串口连接到交换机。

2. 进入特权模式(视厂商而定)

  • 对于思科设备:

    enable
    输入密码进入特权模式。

  • 对于华为设备: 进入用户视图后直接操作。

3. 查看当前的路由配置

以下是不同厂商的常用命令:

思科(Cisco)设备

  • 查看当前路由表:
    show ip route
  • 如果有IPv6路由:
    show ipv6 route

华为(Huawei)设备

  • 查看当前路由表:
    display ip routing-table
  • 查看IPv6路由:
    display ipv6 routing-table

H3C设备

  • 查看当前路由表:
    display ip routing-table
  • 查看IPv6路由:
    display ipv6 routing-table

4. 检查具体的路由协议配置

如果需要查看详细的静态路由或动态路由协议(如OSPF、RIP、BGP)配置:

思科(Cisco)

  • 查看静态路由:
    show running-config | include ip route
  • 查看OSPF配置:
    show running-config | section router ospf
  • 查看BGP配置:
    show running-config | section router bgp

华为(Huawei)

  • 查看静态路由:
    display current-configuration | include ip route-static
  • 查看OSPF配置:
    display current-configuration | section ospf
  • 查看BGP配置:
    display current-configuration | section bgp

H3C

  • 查看静态路由:
    display current-configuration | include ip route-static
  • 查看OSPF配置:
    display current-configuration | section ospf
  • 查看BGP配置:
    display current-configuration | section bgp

5. 退出设备

完成配置查看后,记得安全退出:

exit

注意事项

  • 确保你有足够的权限查看路由配置。
  • 如果设备支持多虚拟路由转发(VRF),可以指定VRF名称来查看特定的路由表,例如:
    display ip routing-table vpn-instance <vrf-name>  # 华为
    show ip route vrf <vrf-name>  # 思科