一、静态路由与BFD联动(直连)

H3C静态路由默认下AD=60

拓扑见QQ收藏

正常情况下,1.1.1.1访问2.2.2.2 时数据通过S1->S2,当S1-S2的链路出现故障,快速切换到S1->S3->S2

S1配置:

[S1]vlan 10

[S1-vlan10]vlan 20

[S1]int E1/0/1

[S1-Ethernet1/0/1]port link-type access

[S1-Ethernet1/0/1]port access vlan 10

[S1-Ethernet1/0/1]int e1/0/2        

[S1-Ethernet1/0/2]port link-type access

[S1-Ethernet1/0/2]port access vlan 20 

[S1-Ethernet1/0/2]int vlan 10

[S1-Vlan-interface10]ip add 12.1.1.1 24

[S1-Vlan-interface10]int vlan 20

[S1-Vlan-interface20]ip add 13.1.1.1 24

[S1]int LoopBack 1

[S1-LoopBack1]ip add 1.1.1.1 32

[S1]ip route-static 23.1.1.0 24 13.1.1.3  没有这条路由,链路切换不过来

[S1] ip route-static 2.2.2.2 32 Vlan-interface10 12.1.1.2 bfd control-packet

[S1]ip route-static2.2.2.2 32 13.1.1.3 preference 100

[S1-Vlan-interface10]bfd min-transmit-interval 300         

[S1-Vlan-interface10]bfd min-receive-interval 300

[S1-Vlan-interface10]bfd detect-multiplier 10     注意在接口配置,不是系统视图

S2配置:

[S2]vlan 10 

[S2-vlan10]vlan 30

[S2]int e1/0/1

[S2-Ethernet1/0/1]port link-type access

[S2-Ethernet1/0/1]port access vlan 10

[S2]int e1/0/2

[S2-Ethernet1/0/2]port link-type access

[S2-Ethernet1/0/2]port access vlan 30

[S2]int vlan 10

[S2-Vlan-interface10]ip add 12.1.1.2 24

[S2-Vlan-interface10]int vlan 30

[S2-Vlan-interface30]ip add 23.1.1.2 24

[S2]int LoopBack 0

[S2-LoopBack0]ip add 2.2.2.2 32

[S2]ip route-static 13.1.1.0 24 23.1.1.3   

[S2] ip route-static1.1.1.1 32 Vlan-interface10 12.1.1.1 bfd control-packet

[S2]ip route-static1.1.1.1 32 23.1.1.3 preference 100

[S2-Vlan-interface10]bfd min-transmit-interval 300      

[S2-Vlan-interface10]bfd min-receive-interval 300

[S2-Vlan-interface10]bfd detect-multiplier 10

S3配置:

[S3]vlan 20   

[S3-vlan20]vlan 30

[S3-vlan30]int e1/0/1

[S3-Ethernet1/0/1]port link-type access

[S3-Ethernet1/0/1]port access vlan 20

[S3-Ethernet1/0/1]int e1/0/2          

[S3-Ethernet1/0/2]port link-type access

[S3-Ethernet1/0/2]port access vlan 30 

[S3]int vlan 20

[S3-Vlan-interface20]ip add 13.1.1.3 24

[S3-Vlan-interface20]int vlan 30

[S3-Vlan-interface30]ip add 23.1.1.3 24

[S3]ip route-static1.1.1.1 32 13.1.1.1

[S3]ip route-static 2.2.2.232 23.1.1.2

注意:由于用的是交换机,为了防止环路,所以有一个接口会是阻塞状态,切换的速度快慢取决于STP的模式

二、静态路由与BFD的联动(非直连)

拓扑见QQ收藏

R1配置

[R1]int G0/0

[R1-GigabitEthernet0/0]ipadd 10.1.1.1 24

[R1-GigabitEthernet0/0]undoshut

[R1-GigabitEthernet0/0]intg0/1

[R1-GigabitEthernet0/1]ipadd 13.1.1.1 24

[R1-GigabitEthernet0/1]intlo 0

[R1-LoopBack0]ipadd 1.1.1.1 32

[R1-LoopBack0]int lo 11

[R1-LoopBack11]ipadd 11.1.1.1 32

[R1]bfd multi-hop min-transmit-interval 500

[R1] bfd multi-hop min-receive-interval 500

[R1] bfd multi-hop detect-multiplier 9

[R1] ip route-static 2.2.2.2 32  22.2.2.2  bfd control-packet bfd-source 11.1.1.1

[R1] ip route-static 2.2.2.232 13.1.1.3  preference 100

[R1]ip route-static 20.1.1.0 24 10.1.1.10

[R1]ip route-static 22.2.2.2 32 10.1.1.10

[R1]ip route-static 23.1.1.0 24 13.1.1.3 

R2配置

[R2]int g0/0

[R2-GigabitEthernet0/0]ipadd 20.1.1.2 24

[R2-GigabitEthernet0/0]undoshut

[R2-GigabitEthernet0/0]intg0/1

[R2-GigabitEthernet0/1]ipadd 23.1.1.2 24

[R2-GigabitEthernet0/1]undoshut

[R2-GigabitEthernet0/1]intlo 0

[R2-LoopBack0]ipadd 2.2.2.2 32

[R2-LoopBack0]intlo 22

[R2-LoopBack22]ipadd 22.2.2.2 32

[R2]bfd multi-hop min-transmit-interval 500

[R2] bfd multi-hop min-receive-interval 500

[R2] bfd multi-hop detect-multiplier 9

[R2] ip route-static 1.1.1.1 32  11.1.1.1  bfd control-packet bfd-source 22.2.2.2

[R2] ip route-static 1.1.1.1 32 23.1.1.3  preference 100


[R2]ip route-static 11.1.1.1 32 20.1.1.20

[R2]ip route-static 10.1.1.0 24 20.1.1.20

[R2]ip route-static 13.1.1.0 24 23.1.1.3

R3配置

[R3]int g0/0

[R3-GigabitEthernet0/0]ip add 13.1.1.3 24

[R3-GigabitEthernet0/0]undo shut

[R3-GigabitEthernet0/0]int g0/1

[R3-GigabitEthernet0/1]ip add 23.1.1.3 24

[R3-GigabitEthernet0/1]undo shut

[R3]ip route-static 1.1.1.1 32 13.1.1.1

[R3]ip route-static 2.2.2.2 32 23.1.1.2

R0的配置

[R0]vlan 10

[R0-vlan10]porte1/0/1

[R0-vlan10]vlan 20

[R0-vlan20]porte1/0/2

[R0-vlan20]int vlan 10

[R0-Vlan-interface10]ip add 10.1.1.10 24

[R0-Vlan-interface10]int vlan 20

[R0-Vlan-interface20]ip add 20.1.1.20 24

[R0]ip route-static 1.1.1.1 32 10.1.1.1

[R0]ip route-static 2.2.2.2 32 20.1.1.2

[SW]ip route-static 11.1.1.1 32 10.1.1.1

[SW]ip route-static 22.2.2.2 32 20.1.1.2