1.r1上有两个环回分别为192.168.1.0/24和192.168.2.0/24只允许学到汇总和1.0
2.r7上有两个环回172.16.1.0/24和172.16.2.0/24 要求全部宣告,但是只有2.0可以通过
3.全网可达
r1,r2,r3,r4,r5,r6,r7分别配(这里以r1为例)
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 1.1.1.1 32
[r1-LoopBack0]q
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
r1
[r1]rip 1
[r1-rip-1]version 2
[r1-rip-1]network 12.0.0.0
[r1-rip-1]network 1.0.0.0
r2同上
r3
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[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]network 34.1.1.1 0.0.0
r4
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
r5
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 45.1.1.2 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
r6
[r6]ospf 2 router-id 6.6.6.6
[r6-ospf-2]area 0
[r6-ospf-2-area-0.0.0.0]network 67.1.1.1 0.0.0.0
[r6-ospf-2-area-0.0.0.0]network 6.6.6.6 0.0.0.0
r7
[r7]ospf 2 router-id 7.7.7.7
[r7-ospf-2]area 0
[r7-ospf-2-area-0.0.0.0]network 0.0.0.0 255.255.255.255
完成以上基本配置,接下来按要求做
r1
[r1]interface LoopBack 1
[r1-LoopBack1]ip address 192.168.1.1 24
[r1-LoopBack1]q
[r1]interface LoopBack 2
[r1-LoopBack2]ip address 192.168.2.1 24
r7
[r7]interface LoopBack 1
[r7-LoopBack1]ip address 172.16.1.1 24
[r7-LoopBack1]q
[r7]interface LoopBack 2
[r7-LoopBack2]ip address 172.16.2.1 24
r1宣告
[r1]rip 1
[r1-rip-1]version 2
[r1-rip-1]network 192.168.1.0
[r1-rip-1]network 192.168.2.0
r1
[r1]bgp 100
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 2.2.2.2 as-number 100
[r1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
r2
[r2]bgp 100
[r2-bgp]peer 1.1.1.1 as-number 100
r3
[r3]bgp 100
[r3-bgp]router-id 3.3.3.3
[r3-bgp]peer 23.1.1.1 as-number 100
[r3-bgp]peer 5.5.5.5 as-number 101
[r3-bgp]peer 5.5.5.5 connect-interface LoopBack 0
r5
[r5]bgp 101
[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 3.3.3.3 as-number 101
[r5-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[r5-bgp]peer 56.1.1.2 as-number 102
r6
[r6]bgp 102
[r6-bgp]router-id 6.6.6.6
[r6-bgp]peer 56.1.1.1 as-number 101
[r6-bgp]peer 7.7.7.7 as-number 102
[r6-bgp]peer 7.7.7.7 connect-interface LoopBack 0
r7
[r7]bgp 102
[r7-bgp]router-id 7.7.7.7
[r7-bgp]peer 6.6.6.6 as-number 102
[r7-bgp]peer 6.6.6.6 connect-interface LoopBack 0
在r5上查看
在r7上查看
r2
[r2-bgp]import-route rip 1
r3
[r3-bgp]import-route ospf 1
r5
[r5-bgp]import-route ospf 1
r6
[r6-bgp]import-route ospf 2
r3
[r3-bgp]peer 5.5.5.5 next-hop-local
r2
[r2]ospf 1
[r2-ospf-1]import-route bgp
[r2-ospf-1]q
[r2]bgp 100
[r2-bgp]network 192.168.1.0 24
[r2-bgp]network 192.168.2.0 24
[r2-bgp]aggregate 192.168.0.0 32
[r2-bgp]q
[r2]ip ip-prefix xx permit 192.168.1.0 24
[r2]route-policy yy permit node 10
[r2-route-policy]if-match ip-prefix xx
[r2-route-policy]q
[r2]bgp 100
[r2-bgp]aggregate 192.168.0.0 22 detail-suppressed suppress-policy yy
在r7上查看
由于只有2.0可以通过,在r6上做抑制
[r6]ip ip-prefix xx permit 172.16.1.1 32
[r6]route-policy yy deny node 10
[r6-route-policy]if-match ip-prefix xx
[r6-route-policy]q
[r6]route-policy yy permit node 20
[r6-route-policy]q
[r6]bgp 102
[r6-bgp]peer 56.1.1.1 route-policy yy export
在r5上查看