需求:
PC_1访问PC_6有俩条路线,链路无异常时流量路径为PC_1----SW1---RT1---SW2----PC_6,RT2为备用线路。现需要实现当主用线路故障后自动切换至备用路线上,当主用线路恢复后流量自动回切
配置SW1:
//接口配置
interface GigabitEthernet1/0/1
port link-mode route
ip address 1.1.1.1 255.255.255.252
interface GigabitEthernet1/0/2
port link-mode route
ip address 2.2.2.1 255.255.255.252
//BFD配置
bfd echo-source-ip 100.100.100.100 //source地址可以任意指定,不需要与实际地址对应,建议不要将源地址配置为属于该设备任何一个接口所在网段
interface GigabitEthernet1/0/1 //接口下配置BFD检测参数
bfd detect-multiplier 3
路由配置:
ip route-static 192.168.1.0 24 GigabitEthernet1/0/1 1.1.1.2 bfd echo-packet //主用路由优先级为默认60
ip route-static 192.168.1.0 24 GigabitEthernet1/0/2 2.2.2.2 preference 65 //备用路由优先级为65
SW2,RT1,RT2配置省略,查看SW1上状态信息
主用链路正常时:
[SW1]dis ip routing-table protocol static
Summary count : 1
Static Routing table status : <Active>
Summary count : 1
Destination/Mask Proto Pre Cost NextHop Interface
192.168.1.0/24 Static 60 0 1.1.1.2 GE1/0/1
BFD状态:
[SW1]display bfd session
Total Session Num: 1 Up Session Num: 1 Init Mode: Active
IPv4 session working in echo mode:
LD SourceAddr DestAddr State Holdtime Interface
129 1.1.1.1 1.1.1.2 Up 1160ms GE1/0/1
PC_1上路由追踪:
<H3C>tracert 192.168.1.254
traceroute to 192.168.1.254 (192.168.1.254), 30 hops at most, 40 bytes each packet, press CTRL_C to break
1 192.168.100.254 (192.168.100.254) 0.000 ms 1.000 ms 0.000 ms
2 1.1.1.2 (1.1.1.2) 1.000 ms 1.000 ms 0.000 ms
3 3.3.3.2 (3.3.3.2) 1.000 ms 1.000 ms 1.000 ms
主用线路故障后:
路由信息
dis ip routing-table protocol static
Summary count : 1
Static Routing table status : <Active>
Summary count : 1
Destination/Mask Proto Pre Cost NextHop Interface
192.168.1.0/24 Static 65 0 2.2.2.2 GE1/0/2
Static Routing table status : <Inactive>
Summary count : 0
路由追踪:
<H3C>tracert 192.168.1.254
traceroute to 192.168.1.254 (192.168.1.254), 30 hops at most, 40 bytes each packet, press CTRL_C to break
1 192.168.100.254 (192.168.100.254) 0.000 ms 0.000 ms 1.000 ms
2 2.2.2.2 (2.2.2.2) 1.000 ms 1.000 ms 0.000 ms
3 4.4.4.2 (4.4.4.2) 1.000 ms 0.000 ms 1.000 ms