1,所有设备运行BGP协议并建立邻居关系
2,AR1和AR5各发布一个网段,两个网段可以互相访问
3,AR后配置172.16.16.0.0/24和172.16.1.0/24网段,使用重发布的方式,仅发布这两个网段
4,针对172开头的网段进行汇总,并抑制172.16.0.0/24而不抑制172.16.1.0/24
配置IP地址
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[R1]int l1
[R1-LoopBack1]ip add 172.16.0.1 24
[R1-LoopBack1]int l2
[R1-LoopBack2]ip add 172.16.1.1 24
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 23.0.0.1 24
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 23.0.0.2 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 34.0.0.1 24
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 34.0.0.2 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 45.0.0.1 24
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 45.0.0.2 24
[R5]int l0
[R5-LoopBack0]ip add 10.0.0.1 24
[R5-LoopBack0]q
建立EBGP直连邻居
[R1]bgp 1
[R1-bgp]route-select
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 12.0.0.2 as-number 2
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2]bgp 2
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 12.0.0.1 as-number 1
[R4]bgp 2
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 45.0.0.2 as-number 3
[R3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R5]bgp 3
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 45.0.0.1 as-number 2
[R1-bgp]network 1.1.1.0 24
[R2-bgp]peer 3.3.3.3 next-hop-local
[R2-bgp]peer 4.4.4.4 next-hop-local
[R5]bgp 3
[R5-bgp]network 10.0.0.0 24
[R4-bgp]peer 3.3.3.3 next-hop-local
[R4-bgp]peer 2.2.2.2 next-hop-local
[R1]ip ip-prefix aa permit 172.16.0.0 16 greater-equal 24 less-equal 24
[R1]route-policy aa permit node 10
[R1-route-policy]if-match ip-prefix aa
[R1-bgp]import-route direct route-policy aa
[R4]ip ip-prefix aa permit 172.16.0.0 24
[R4]route-policy aa permit node 10
[R4-route-policy]if-match ip-prefix aa
[R4]bgp 2
[R4-bgp]aggregate 172.16.0.0 23 suppress-policy aa