小工具知识网

当前位置: 首页 > 行业知识 > 华为配置IPv4静态路由与EFM联动示例

行业知识

华为配置IPv4静态路由与EFM联动示例

2026-11-18 23:03:48 来源:互联网转载

配置IPv4静态路由与EFM联动示例

��1 配置IPv4静态路由与EFM联动组网图

 

  • IPv4静态路由与EFM联动简介
  • 配置注意事项
  • 组网需求
  • 配置思路
  • 操作步骤
  • 配置文件
  • 相关信息
    IPv4静态路由与EFM联动简介

    最后一公里以太网EFM(Ethernet in the First Mile)主要用于接入部分的以太网物理层规范以及以太网管理和维护,是链路级的OAM(Operation and Management)。针对两台直连设备之间的链路,提供链路连通性检测功能、链路故障监控功能、远端故障通知功能和远端环回功能。

    静态路由由于配置简单,广泛应用于结构较简单的网络中。但是,与动态路由协议不同,静态路由自身没有检测机制,当网络发生故障时,静态路由无法感知,需要由管理员介入,这样无法保证及时进行链路切换,可能造成业务较长时间中断。然而,随着网络的快速发展,IP网络越来越多的承载语音、视频等多种业务,这些业务对网络的高可靠性提出了更高的要求,需要更快的故障感知能力和故障处理速度。为了给静态路由引入检测机制,使静态路由能够及时感知到链路质量的变化,并及时进行业务切换,可以考虑配置IPv4静态路由与EFM联动。

    配置注意事项
    • 缺省情况下,全局EFM功能未使能,各接口的EFM功能未使能。
    • 当使能接口的EFM功能后,接口开始发送OAMPDU,开始点到点的EFM链路检测。只有当对端端口也使能了EFM功能,才能进入EFM链路检测阶段。
    • 适用的产品和版本:所有型号的交换机都适用。
      组网需求

      如图1所示,SwitchA通过SwitchB和NMS跨网段相连,SwitchA通过静态路由与NMS进行正常通信。现希望在SwitchA和SwitchB间实时检测链路质量,在链路出现问题时将对应的静态路由从IP路由表删除,使业务流量切换到无链路故障的路由,提高网络的可靠性。

      配置思路

      采用如下思路配置IPv4静态路由与EFM联动:

      1. 在SwitchA和SwitchB上使能EFM OAM功能(全局和接口下使能),实现对链路质量的实时检测。

      2. 配置SwitchA到NMS的静态路由并绑定efm-state,实现IPv4静态路由与EFM联动,在链路出现问题时,及时切换到无链路故障的路由。

      操作步骤
      1. 配置各接口所属的VLAN
        # 配置SwitchA。SwitchB的配置与SwitchA类似。 system-view[HUAWEI] sysname SwitchA[SwitchA] vlan 10[SwitchA-vlan10] quit[SwitchA] interface gigabitethernet 0/0/1[SwitchA-GigabitEthernet0/0/1] port link-type trunk[SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 10[SwitchA-GigabitEthernet0/0/1] quit
      2. 配置各VLANIF接口的IP地址
        # 配置SwitchA。SwitchB的配置与SwitchA类似。[SwitchA] interface vlanif 10[SwitchA-Vlanif10] ip address 192.168.1.1 24[SwitchA-Vlanif10] quit
      3. 配置SwitchA和SwitchB间的EFM会话
        # 在SwitchA上使能EFM OAM功能。[SwitchA] efm enable   //全局使能EFM功能[SwitchA] interface gigabitethernet 0/0/1[SwitchA-GigabitEthernet0/0/1] efm enable   //接口使能EFM功能[SwitchA-GigabitEthernet0/0/1] quit# 在SwitchB上使能EFM OAM功能。[SwitchB] efm enable   //全局使能EFM功能[SwitchB] interface gigabitethernet 0/0/1[SwitchB-GigabitEthernet0/0/1] efm enable   //接口使能EFM功能[SwitchB-GigabitEthernet0/0/1] quit
      4. 配置静态路由并绑定efm-state
        # 在SwitchA配置到外部网络的静态路由,并绑定GigabitEthernet0/0/1接口的efm-state。[SwitchA] ip route-static 192.168.2.0 24 192.168.1.2 track efm-state gigabitethernet0/0/1
      5. 验证配置结果
        # 配置完成后,在SwitchA和SwitchB上执行display efm session all命令,可以看到EFM会话已经建立,且状态为detect,即接口处于握手状态,SwitchA上的显示为例。[SwitchA] display efm session all  Interface                 EFM State                   Loopback Timeout  ----------------------------------------------------------------------  GigabitEthernet0/0/1      detect                      --# 在SwitchA查看IP路由表,静态路由存在于路由表中。[SwitchA] display ip routing-tableRoute Flags: R - relay, D - download to fib, T - to ***-instance------------------------------------------------------------------------------Routing Tables: Public         Destinations : 5       Routes : 5       Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0    192.168.1.0/24  Direct  0    0           D   192.168.1.1     Vlanif10    192.168.1.1/32  Direct  0    0           D   127.0.0.1       Vlanif10    192.168.2.0/24  Static  60   0          RD   192.168.1.2     Vlanif10# 在SwitchB接口GigabitEthernet0/0/1视图下执行undo efm enable命令模拟链路故障。[SwitchB] interface gigabitethernet 0/0/1[SwitchB-GigabitEthernet0/0/1] undo efm enable# 在SwitchA上执行display efm session all命令,可以看到EFM OAM协议状态为discovery,即接口处于对端发现状态。[SwitchA] display efm session all  Interface                 EFM State                   Loopback Timeout  ----------------------------------------------------------------------  GigabitEthernet0/0/1      discovery                   --# 查看SwitchA的路由表,发现静态路由192.168.2.0/24也不存在了。因为静态路由绑定了efm-state,当EFM OAM检测到链路故障后,就会迅速通知所绑定的静态路由不可用。[SwitchA] display ip routing-tableRoute Flags: R - relay, D - download to fib, T - to ***-instance------------------------------------------------------------------------------Routing Tables: Public         Destinations : 4       Routes : 4       Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0    192.168.1.0/24  Direct  0    0           D   192.168.1.1     Vlanif10    192.168.1.1/32  Direct  0    0           D   127.0.0.1       Vlanif10# 在SwitchB接口GigabitEthernet0/0/1视图下执行efm enable命令模拟链路恢复正常。[SwitchB-GigabitEthernet0/0/1]efm enable# 在SwitchA上执行display efm session all命令,可以看到EFM OAM协议状态恢复为detect,即接口处于握手状态。[SwitchA] display efm session all  Interface                 EFM State                   Loopback Timeout  ----------------------------------------------------------------------  GigabitEthernet0/0/1      detect                      --# 查看SwitchA的路由表,发现静态路由192.168.2.0/24重新出现在路由表中。因为当EFM OAM检测到链路恢复正常后,就会迅速通知所绑定的静态路由重新生效。[SwitchA] display ip routing-tableRoute Flags: R - relay, D - download to fib, T - to ***-instance------------------------------------------------------------------------------Routing Tables: Public         Destinations : 5       Routes : 5       Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0    192.168.1.0/24  Direct  0    0           D   192.168.1.1     Vlanif10    192.168.1.1/32  Direct  0    0           D   127.0.0.1       Vlanif10    192.168.2.0/24  Static  60   0          RD   192.168.1.2     Vlanif10
      配置文件
      • SwitchA的配置文件# sysname SwitchA#vlan batch 10#efm enable#interface Vlanif10 ip address 192.168.1.1 255.255.255.0#interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 10 efm enable#ip route-static 192.168.2.0 255.255.255.0 192.168.1.2 track efm-state GigabitEthernet0/0/1#returnSwitchB的配置文件#sysname SwitchB#vlan batch 10 20#efm enable#interface Vlanif10 ip address 192.168.1.2 255.255.255.0#interface Vlanif20 ip address 192.168.2.2 255.255.255.0#interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 10 efm enable#interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 20#return

上一篇:win10如何重装为win7系统?

下一篇:idc服务器怎么入门?