Topology
Require
1. All devices run the BGP protocol and establish neighbor relationships
2. AR1 and AR5 each publish a network segment, and the two network segments can access each other
3. After AR1, configure the 172.16.0.0/24 and 172.16.1.0/24 network segments, and use the re-publishing method to publish only these two network segments
4. For the network starting with 172 segments and suppress 172.16.0.0/24 without suppressing 172.16.1.0/24
1. IP configuration
R1 configuration:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[R1]int l0
[R1-LoopBack0]ip add 172.16.0.1 24
[R1-LoopBack0]int l1
[R1-LoopBack1]ip add 172.16.1.1 24
[R1-LoopBack1]int l2
[R1-LoopBack2]ip add 1.1.1.1 24
R2配置:
[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
[R2-GigabitEthernet0/0/1]int l0
[R2-LoopBack0] ip add 2.2.2.2 24
R3 configuration:
[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
[R3-GigabitEthernet0/0/1]int l0
[R3-LoopBack0] ip add 3.3.3.3 24
R4配置:
[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
[R4-GigabitEthernet0/0/1]int l0
[R4-LoopBack0] ip add 4.4.4.424
R5配置:
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 45.0.0.2 24
[R5]int l0
[R5-LoopBack0]ip add 5.5.5.5 24
2. Use ospf in AS2 to achieve full network communication
R2配置:
[R2]ospf 1 rou
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]network 23.0.0.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 2.2.2.0 0.0.0.255
R3 configuration:
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]network 23.0.0.2 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 34.0.0.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.0 0.0.0.255
R4 configuration:
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]a 0
[R4-ospf-1-area-0.0.0.0]network 34.0.0.2 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 4.4.4.0 0.0.0.255
3. Establish EBGP peers and IBGP peers
R1 configuration
[R1]bgp 1
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 12.0.0.2 as-number 2
R2 configuration
[R2]bgp 2
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 12.0.0.1 as-number 1
[R2-bgp]peer 3.3.3.3 as-number 2
[R2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R2-bgp]peer 3.3.3.3 next-hop-local
R3 configuration
[R3]bgp 2
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 2.2.2.2 as-number 2
[R3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R3.-bgp]peer 2.2.2.2 next-hop-local
[R3-bgp]peer 4.4.4.4 as-number 2
[R3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R3.-bgp]peer 4.4.4.4 next-hop-local
R4 configuration
[R4]bgp 2
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 3.3.3.3 as-number 2
[R4-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R4.-bgp]peer 3.3.3.3 next-hop-local
[R4-bgp]peer 45.0.0.2 as-number 3
R5 configuration
[R4]bgp 3
[R4-bgp]router-id 5.5.5.5
[R4-bgp]peer 4.4.4.4 as-number 2
4. Redistribute the routing policy to the 172.16.0.0/24 network segment and the 176.16.1.0/24 network segment
R1配置:
[R1]ip ip-prefix cc index 10 permit 172.16.0.0 18 greater-equal 24 less-equal 24
[R1]route-policy cc permit node 10
[R1-route-policy]if-match ip-prefix cc
[R1]bgp 1
[R1-bgp]import-route direct route-policy cc
[R1-bgp]aggregate 172.16.0.0 255.255.255.0
5. Suppress detailed routing 172.16.0.0/24
[R1]ip ip-prefix dd index 10 permit 172.16.0.0 24
[R1]route-policy dd permit node 20
[R1-route-policy]if-match ip-prefix dd
[R1-bgp]aggregate 172.16.0.0 255.255.255.0 suppress-policy dd
Turn on automatic aggregation
[R1-bgp]summary automatic
View routing information