1. 实验目的
2. 实验拓扑
实验拓扑如图5-2所示:
图5-2:BGP水平分割
3. 实验步骤
(1)配置IP地址
R1的配置
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname R1
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
[R1-GigabitEthernet0/0/0]quit
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 1.1.1.1 32
[R1-LoopBack0]quit
R2的配置
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname R2
[R2]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip address 12.1.1.2 24
[R2-GigabitEthernet0/0/1]quit
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip address 23.1.1.2 24
[R2-GigabitEthernet0/0/0]quit
[R2]interface LoopBack 0
[R2-LoopBack0]ip address 2.2.2.2 32
[R2-LoopBack0]quit
R3的配置
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname R3
[R3]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip address 23.1.1.3 24
[R3-GigabitEthernet0/0/1]quit
[R3]interface LoopBack 0
[R3-LoopBack0]ip address 3.3.3.3 32
[R3-LoopBack0]quit
(2) 配置IGP:R1、R2、R3运行OSPF协议,且都属于区域0
R1的配置
[R1]ospf router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]quit
R2的配置
[R2]ospf router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]quit
R3的配置
[R3]ospf router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]quit
(3) 配置IBGP:R2分别与R1和R3建立IBGP的对等体关系
R1的配置
[R1]bgp 123
[R1-bgp]undo summary automatic
[R1-bgp]undo synchronization
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 2.2.2.2 as-number 123
[R1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R1-bgp]quit
R2的配置
[R2]bgp 123
[R2-bgp]undo synchronization
[R2-bgp]undo summary automatic
[R2-bgp]peer 1.1.1.1 as-number 123
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R2-bgp]peer 3.3.3.3 as-number 123
[R2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R2-bgp]quit
R3的配置
[R3]bgp 123
[R3-bgp]undo synchronization
[R3-bgp]undo summary automatic
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 2.2.2.2 as-number 123
[R3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R3-bgp]quit
(4)在R2上查看BGP的对等体关系
[R2]display bgp peer
BGP local router ID : 12.1.1.2
Local AS number : 123
Total number of peers : 2 Peers in established state : 0
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
1.1.1.1 4 123 0 0 0 00:02:46 Connect 0
3.3.3.3 4 123 0 0 0 00:02:35 Connect
通过以上输出可以看到,R2分别与R1和R3建立了IBGP的对等体关系
4. 实验调试
[R1]interface LoopBack 100
[R1-LoopBack100]ip address 100.100.100.100 32
[R1-LoopBack100]quit
[R1]bgp
[R1]bgp 123
[R1-bgp]network 100.100.100.100 32
[R1-bgp]quit
[R1]display bgp routing-table
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 100.100.100.100/32 0.0.0.0 0 0 i
通过以上输出可以看到,100.100.100.100这条路由是最优的,会传递给R2
[R2]display bgp routing-table
BGP Local router ID is 12.1.1.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 100.100.100.100/32 1.1.1.1 0 100 0 i
通过以上输出可以看到,100.100.100.100这条路由在R2中也是最优的,它会不会传递给R3了?
[R3]display bgp routing-table
通过以上输出可以看到R3的路由表为空,这是由于水平分割的原因:从IBGP对等体获取的路由,不会发送给IBGP对等体,它的目的是为了防止IBGP的环路问题。
【水平分割】解决办法
接下来的实验我们用路由反射器来解决水平分割的问题,其它办法请读者自行配置
[R2]bgp 123
[R2-bgp]peer 1.1.1.1 reflect-client
[R2-bgp]quit
【技术要点】路由反射器
注意:如果读者记不住,那就记住四个字:非非不传
BGP Local router ID is 3.3.3.3
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 100.100.100.100/32 1.1.1.1 0 100 0 i
通过以上输出可以R3收到了100.100.100.100这条路由,因为R2为路由反射器,R1为路由反射器的客户端,R3为路由反射器的非客户端,只有非非不传,所以对R2来说,它从客户端收到一条路由会传给他的非客户端。