-
配置各接口所属VLAN [LSW1]vlan batch 12 13 [LSW1-GigabitEthernet0/0/2]port link-type trunk [LSW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 12 [LSW1-GigabitEthernet0/0/3]port link-type trunk [LSW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 13 [LSW2]vlan batch 10 12 23 [LSW2-GigabitEthernet0/0/1]port link-type trunk [LSW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 12 [LSW2-GigabitEthernet0/0/3]port link-type trunk [LSW2-GigabitEthernet0/0/3]port trunk allow-pass vlan 23 [LSW2-GigabitEthernet0/0/2]port link-type trunk [LSW2-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 [LSW3]vlan batch 13 23 [LSW3-GigabitEthernet0/0/1]port link-type trunk [LSW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 13 [LSW3-GigabitEthernet0/0/2]port link-type trunk [LSW3-GigabitEthernet0/0/2]port trunk allow-pass vlan 23 -
配置各VLANIF接口的IP地址 [LSW1-Vlanif12]ip add 10.1.12.1 24 [LSW1-Vlanif13]ip add 10.1.13.1 24 [LSW2-Vlanif10]ip add 192.168.1.2 24 [LSW2-Vlanif12]ip add 10.1.12.2 24 [LSW2-Vlanif23]ip add 10.1.23.2 24 [LSW3-Vlanif13]ip add 10.1.13.3 24 [LSW3-Vlanif23]ip add 10.1.23.3 24 [LSW1]stp disable [LSW2]stp disable [LSW3]stp disable -
配置BGP基本功能,在LSW1和LSW2,LSW1和LSW3之间建立EBGP连接,LSW2和LSW3之间建立IBGP连接 [LSW1]bgp 100 [LSW1-bgp]router-id 1.1.1.1 [LSW1-bgp]peer 10.1.12.2 as-number 200 [LSW1-bgp]peer 10.1.12.2 ebgp-max-hop [LSW1-bgp]peer 10.1.13.3 as-number 200 [LSW1-bgp]peer 10.1.13.3 ebgp-max-hop [LSW2]bgp 200 [LSW2-bgp]router-id 2.2.2.2 [LSW2-bgp]peer 10.1.12.1 as-number 100 [LSW2-bgp]peer 10.1.12.1 ebgp-max-hop [LSW2-bgp]peer 10.1.23.3 as-number 200 [LSW2-bgp]network 192.168.1.0 24 [LSW3]bgp 200 [LSW3-bgp]router-id 3.3.3.3 [LSW3-bgp]peer 10.1.13.1 as-number 100 [LSW3-bgp]peer 10.1.13.1 ebgp-max-hop [LSW3-bgp]peer 10.1.23.2 as-number 200 -
配置MED属性:通过策略配置LSW2和LSW3送给LSW1的MED值 [LSW2]route-policy 12 permit node 12 [LSW2-route-policy]apply cost 100 [LSW2-bgp]peer 10.1.12.1 route-policy 12 export [LSW3]route-policy 13 permit node 13 [LSW3-route-policy]apply cost 150 [LSW3]bgp 200 [LSW3-bgp]peer 10.1.13.1 route-policy 13 export
可以看出,去往192.168.1.0/24的路由下一跳地址为10.1.12.2,流量在主链路LSW1、LSW2上传输 5. 配置BFD检测功能、发送和接收间隔、本地检测时间倍数 [LSW1]bfd [LSW1]bgp 100 [LSW1-bgp]peer 10.1.12.2 bfd enable [LSW1-bgp]peer 10.1.12.2 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4 [LSW2]bfd [LSW2]bgp 200 [LSW2-bgp]peer 10.1.12.1 bfd enable [LSW2-bgp]peer 10.1.12.1 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4
- 验证配置
对LSW2的VLANIF12接口执行shutdown命令,模拟主链路故障 [LSW2-Vlanif12]shutdown
可以看出,在主链路失效后,备份链路LSW1→LSW3→LSW2生效,去往192.168.10/24的路由下一跳地址为10.1.13.3
|