3.OSPF与BGP的联动

14.3实验3:OSPF与BGP联动配置

  1. 实验目的
  2. 实验拓扑

3.OSPF与BGP的联动_第1张图片

  1. 实验步骤
  1. 配置IP地址
  1. AR1的配置

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

  1. AR2的配置

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

  1. AR3的配置

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

  1. AR4的配置

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

  1. AR5的配置

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

  1. 运行IGP
  1. 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

  1. 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

  1. 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

  1. 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

  1. 运行BGP
  1. 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

  1. 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

  1. 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

  1. 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

  1. 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

  1. 在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

  1. 实验调试
  1. 在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

  1. 关闭AR2查看现象

OSPF的收敛速度快,BGP的收敛速度慢,会造成数据丢失。

  1. 在AR2上配置

[AR2]ospf

[AR2-ospf-1]stub-router

[AR2-ospf-1]quit

  1. 在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

把路由的开销设置为65535,就不会选这条路,等故障收敛完成后,再改回来。

你可能感兴趣的:(网络,网络协议,服务器)