14.3实验3:OSPF与BGP联动配置
- 实验目的
- 实验拓扑
- 实验步骤
- 配置IP地址
- AR1的配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname AR1
[AR1]interface g0/0/0
[AR1-GigabitEthernet0/0/0]ip address 10.0.12.1 24
[AR1-GigabitEthernet0/0/0]quit
[AR1]interface g0/0/1
[AR1-GigabitEthernet0/0/1]ip address 10.0.13.1 24
[AR1-GigabitEthernet0/0/1]quit
[AR1]interface LoopBack 0
[AR1-LoopBack0]ip address 1.1.1.1 32
[AR1-LoopBack0]quit
- AR2的配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname AR2
[AR2]interface g0/0/0
[AR2-GigabitEthernet0/0/0]ip address 10.0.24.2 24
[AR2-GigabitEthernet0/0/0]quit
[AR2]interface g0/0/1
[AR2-GigabitEthernet0/0/1]ip address 10.0.12.2 24
[AR2-GigabitEthernet0/0/1]quit
[AR2]interface LoopBack 0
[AR2-LoopBack0]ip address 2.2.2.2 32
[AR2-LoopBack0]quit
- AR3的配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname AR3
[AR3]interface g0/0/0
[AR3-GigabitEthernet0/0/0]ip address 10.0.13.3 24
[AR3-GigabitEthernet0/0/0]quit
[AR3]interface g0/0/1
[AR3-GigabitEthernet0/0/1]ip address 10.0.34.3 24
[AR3-GigabitEthernet0/0/1]quit
[AR3]interface LoopBack 0
[AR3-LoopBack0]ip address 3.3.3.3 32
[AR3-LoopBack0]quit
- AR4的配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname AR4
[AR4]interface g0/0/0
[AR4-GigabitEthernet0/0/0]ip address 10.0.34.4 24
[AR4-GigabitEthernet0/0/0]quit
[AR4]interface g0/0/1
[AR4-GigabitEthernet0/0/1]ip address 10.0.24.4 24
[AR4-GigabitEthernet0/0/1]quit
[AR4]interface g0/0/2
[AR4-GigabitEthernet0/0/2]ip address 10.0.45.4 24
[AR4-GigabitEthernet0/0/2]quit
[AR4]interface LoopBack 0
[AR4-LoopBack0]ip address 4.4.4.4 32
[AR4-LoopBack0]quit
- AR5的配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname AR5
[AR5]interface g0/0/0
[AR5-GigabitEthernet0/0/0]ip address 10.0.45.5 24
[AR5-GigabitEthernet0/0/0]quit
[AR5]interface LoopBack 0
[AR5-LoopBack0]ip address 5.5.5.5 32
[AR5-LoopBack0]quit
- 运行IGP
- AR1的配置
[AR1]ospf router-id 1.1.1.1
[AR1-ospf-1]area 0
[AR1-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255
[AR1-ospf-1-area-0.0.0.0]network 10.0.13.0 0.0.0.255
[AR1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[AR1-ospf-1-area-0.0.0.0]quit
- AR2的配置
[AR2]ospf router-id 2.2.2.2
[AR2-ospf-1]area 0
[AR2-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255
[AR2-ospf-1-area-0.0.0.0]network 10.0.24.0 0.0.0.255
[AR2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[AR2-ospf-1-area-0.0.0.0]quit
- AR3的配置
[AR3]ospf router-id 3.3.3.3
[AR3-ospf-1]area 0
[AR3-ospf-1-area-0.0.0.0]network 10.0.13.0 0.0.0.255
[AR3-ospf-1-area-0.0.0.0]network 10.0.34.0 0.0.0.255
[AR3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[AR3-ospf-1-area-0.0.0.0]quit
- AR4的配置
[AR4]ospf router-id 4.4.4.4
[AR4-ospf-1]area 0
[AR4-ospf-1-area-0.0.0.0]network 10.0.24.0 0.0.0.255
[AR4-ospf-1-area-0.0.0.0]network 10.0.34.0 0.0.0.255
[AR4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[AR4-ospf-1-area-0.0.0.0]quit
- 运行BGP
- AR1的配置
[AR1]bgp 100
[AR1-bgp]undo synchronization
[AR1-bgp]peer 2.2.2.2 as-number 100
[AR1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[AR1-bgp]peer 3.3.3.3 as-number 100
[AR1-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[AR1-bgp]peer 4.4.4.4 as-number 100
[AR1-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[AR1-bgp]network 1.1.1.1 32
[AR1-bgp]quit
- AR2的配置
[AR2]bgp 100
[AR2-bgp]undo synchronization
[AR2-bgp]peer 1.1.1.1 as-number 100
[AR2-bgp]peer 1.1.1.1 connect-interface loo0
[AR2-bgp]peer 3.3.3.3 as-number 100
[AR2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[AR2-bgp]peer 4.4.4.4 as-number 100
[AR2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[AR2-bgp]quit
- AR3的配置
[AR3]bgp 100
[AR3-bgp]undo synchronization
[AR3-bgp]peer 1.1.1.1 as-number 100
[AR3-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[AR3-bgp]peer 2.2.2.2 as-number 100
[AR3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[AR3-bgp]peer 4.4.4.4 as-number 100
[AR3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[AR3-bgp]quit
- AR4的配置
[AR4]bgp 100
[AR4-bgp]undo synchronization
[AR4-bgp]peer 1.1.1.1 as-number 100
[AR4-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[AR4-bgp]peer 2.2.2.2 as-number 100
[AR4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[AR4-bgp]peer 3.3.3.3 as-number 100
[AR4-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[AR4-bgp]peer 10.0.45.5 as-number 101
[AR4-bgp]peer 1.1.1.1 next-hop-local
[AR4-bgp]peer 2.2.2.2 next-hop-local
[AR4-bgp]peer 3.3.3.3 next-hop-local
[AR4-bgp]quit
- AR5的配置
[AR5]bgp 101
[AR5-bgp]router-id 5.5.5.5
[AR5-bgp]undo synchronization
[AR5-bgp]peer 10.0.45.4 as-number 100
[AR5-bgp]network 5.5.5.5 32
[AR5-bgp]quit
- 在R1上创建环回口lo1,并宣告进BGP
[AR1]interface LoopBack 1
[AR1-LoopBack1]ip address 11.11.11.11 32
[AR1-LoopBack1]quit
[AR1]bgp 100
[AR1-bgp]network 11.11.11.11 32
[AR1-bgp]quit
- 实验调试
- 在R3改开销,让11.11.11.11访问5.5.5.5走AR1-AR2-AR4-AR5
[AR3]interface g0/0/1
[AR3-GigabitEthernet0/0/1]ospf cost 10
[AR3-GigabitEthernet0/0/1]quit
- 关闭AR2查看现象
OSPF的收敛速度快,BGP的收敛速度慢,会造成数据丢失。
- 在AR2上配置
[AR2]ospf
[AR2-ospf-1]stub-router
[AR2-ospf-1]quit
- 在AR2上查看OSPF的路由表
[AR2]display ospf routing
OSPF Process 1 with Router ID 2.2.2.2
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
2.2.2.2/32 0 Stub 2.2.2.2 2.2.2.2 0.0.0.0
10.0.12.0/24 65535 Transit 10.0.12.2 2.2.2.2 0.0.0.0
10.0.24.0/24 65535 Transit 10.0.24.2 2.2.2.2 0.0.0.0
1.1.1.1/32 65535 Stub 10.0.12.1 1.1.1.1 0.0.0.0
3.3.3.3/32 65536 Stub 10.0.24.4 3.3.3.3 0.0.0.0
3.3.3.3/32 65536 Stub 10.0.12.1 3.3.3.3 0.0.0.0
4.4.4.4/32 65535 Stub 10.0.24.4 4.4.4.4 0.0.0.0
10.0.13.0/24 65536 Transit 10.0.12.1 1.1.1.1 0.0.0.0
10.0.34.0/24 65536 Transit 10.0.24.4 3.3.3.3 0.0.0.0
Total Nets: 9
Intra Area: 9 Inter Area: 0 ASE: 0 NSSA: 0文章来源:https://www.toymoban.com/news/detail-406243.html
把路由的开销设置为65535,就不会选这条路,等故障收敛完成后,再改回来。文章来源地址https://www.toymoban.com/news/detail-406243.html
到了这里,关于3.OSPF与BGP的联动的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!