对AS2中的IP地址进行划分
172.16.0.0 16
其中,主要分为环回地址和骨干链路地址
选取掩码为24的前8段
172.16.0.0 24----------骨干链路划分
172.16.0.0 30----R2-3
172.16.0.4 30----R3-4
172.16.0.8 30-----R2-5
172.16.0.12 30----R4-7
172.16.0.16 30----R5-6
172.16.0.20 30----R6-7
172.16.1.0 24
172.16.2.0 24-----R2环回
172.16.3.0 24-----R3环回
172.16.4.0 24-----R4环回
172.16.5.0 24-----R5环回
172.16.6.0 24-----R6环回
172.16.7.0 24-----R7环回
R1
interface GigabitEthernet0/0/0
ip address 12.0.0.1 255.255.255.0
interface LoopBack0
ip address 192.168.1.1 255.255.255.0
interface LoopBack1
ip address 10.1.1.1 255.255.255.0
R2
interface GigabitEthernet0/0/0
ip address 12.0.0.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 172.16.0.1 255.255.255.252
interface GigabitEthernet0/0/2
ip address 172.16.0.9 255.255.255.252
interface LoopBack0
ip address 2.2.2.2 255.255.255.0
interface LoopBack1
ip address 172.16.2.1 255.255.255.0
R3
interface GigabitEthernet0/0/0
ip address 172.16.0.2 255.255.255.252
interface GigabitEthernet0/0/1
ip address 172.16.0.5 255.255.255.252
interface LoopBack0
ip address 3.3.3.3 255.255.255.0
interface LoopBack1
ip address 172.16.3.1 255.255.255.0
AS2内部进行ospf的宣告
R2
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 172.16.0.0 0.0.255.255
bgp 64512
router-id 2.2.2.2
confederation id 2
confederation peer-as 64513
peer 3.3.3.3 as-number 64512
peer 3.3.3.3 connect-interface LoopBack0
peer 5.5.5.5 as-number 64513
peer 5.5.5.5 ebgp-max-hop 255
peer 5.5.5.5 connect-interface LoopBack0
peer 12.0.0.1 as-number 1
network 172.16.0.0 255.255.248.0-------将172.16.2.0 24 至 172.16.7.0 24 进行汇总,即172.16.0.0 21
peer 3.3.3.3 next-hop-local
peer 5.5.5.5 next-hop-local
R1
bgp 1
router-id 1.1.1.1
peer 12.0.0.2 as-number 2
network 10.1.1.0 255.255.255.0
检验R2至R7的 bgp peer的邻居关系
由于我们进行了环回汇总,那么,极有可能在 网络中 出现路由黑洞,所以,我们需要在边界路由器即 R2 和 R7 进行空接口防环
命令:
r2:ip route-static 172.16.0.0 255.255.248.0 NULL0
r7:ip route-static 172.16.0.0 255.255.248.0 NULL0
建立隧道
R1:
[R1]int t 0/0/0
[R1-Tunnel0/0/0]ip address 192.168.0.1 30
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]source 10.1.1.1
[R1-Tunnel0/0/0]destination 11.1.1.1
[R1]ip route-static 192.168.2.0 192.168.0.2