一、实验目的
1.r1上有两个环回分别为192.168.1.0/24和192.168.2.0/24只允许学到汇总和1.0
2.r7工有两个环回172.16.1./24和172.16.2.9/24,要求全部宣告,但是只有2.0可以通过
3.全网可达
二、具体配置
1、IP地址配置
R1:
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[R1]interface LoopBack 0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1]interface LoopBack 1
[R1-LoopBack1]ip add 192.168.1.1 24
[R1]interface LoopBack 2
[R1-LoopBack2]ip add 192.168.2.1 24
R2:
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 23.1.1.1 24
[R2]interface LoopBack 0
[R2-LoopBack0]ip add 2.2.2.2 32
R3:
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 23.1.1.2 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 34.1.1.1 24
[R3]interface LoopBack 0
[R3-LoopBack0]ip add 3.3.3.3 32
R4:
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 34.1.1.2 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 45.1.1.1 24
[R4]interface LoopBack 0
[R4-LoopBack0]ip add 4.4.4.4 32
R5:
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 45.1.1.2 24
[R5-GigabitEthernet0/0/0]int g0/0/1
[R5-GigabitEthernet0/0/1]ip add 56.1.1.1 24
[R5]interface LoopBack 0
[R5-LoopBack0]ip add 5.5.5.5 32
R6:
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 56.1.1.2 24
[R6-GigabitEthernet0/0/0]int g0/0/1
[R6-GigabitEthernet0/0/1]ip add 67.1.1.1 24
[R6]int LoopBack 0
[R6-LoopBack0]ip add 6.6.6.6 32
R7:
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 67.1.1.2 24
[R7]int LoopBack 0
[R7-LoopBack0]ip add 7.7.7.7 32
[R7]interface LoopBack 1
[R7-LoopBack1]ip add 172.16.1.1 24
[R7]interface LoopBack 2
[R7-LoopBack2]ip add 172.16.2.1 24
2、RIP、OSPF宣告
RIP:
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
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 192.168.2.0
R2:
[R2]rip 1
[R2-rip-1]version 2
[R2-rip-1]network 12.0.0.0
[R2-rip-1]network 2.0.0.0
OSPF1:
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.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
OSPF2:
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
3、建立邻居关系
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
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R2-bgp]peer 23.1.1.2 as-number 101
R3:
[R3]bgp 101
[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
4、重发布使路由器之间相通
R2:
[R2]bgp 10
[R2-bgp]import-route rip 1
R3:
[R3]bgp 101
[R3-bgp]import-route ospf 1
R5:
[R5]bgp 101
[R5-bgp]import-route ospf 1
R6:
[R6]bgp 102
[R6-bgp]import-route ospf 2
5.设置最优bgp通道
R2:
[R2]bgp 100
[R2-bgp]peer 1.1.1.1 next-hop-local
R3:
[R3]bgp 101
[R3-bgp]peer 5.5.5.5 next-hop-local
R5:
[R5]bgp 101
[R5-bgp]peer 3.3.3.3 next-hop-local
R6:
[R6]bgp 102
[R6-bgp]peer 7.7.7.7 next-hop-local
6.R1上有两个环回分别为192.168.1.0/24和192.168.2.0/24只允许学到汇总和1.0
在R2上手工进行宣告R1的环回并汇总
[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 22
在R2上创建过滤R1中2.0网段的路由策略
[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]bgp 100
[R2-bgp]aggregate 192.168.0.0 22 detail-suppressed suppress-policy yy
7.R7工有两个环回172.16.1./24和172.16.2.9/24要求全部宣告,但是只有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 yy permit node 20
[R6]bgp 102
[R6-bgp]peer 56.1.1.1 route-policy yy export