拓扑图

一.实验要求
1.AS1存在两个环回,一个地址为192.168.1.0/24,该地址不能在任何协议中宣告
AS3存在两个环回,一个地址为192.168.2.0/24,该地址不能在任何协议中宣告
AS1还有一个环回地址为10.1.1.0/24,AS3另一个环回地址是11.1.1.8/24
最终要求这两个环回可以互相通讯
2.整个AS2的IP地址为172.16.0.0/16
3.AS间的骨干链路IP地址随意分配
4.使用BGP协议让整个网络所有设备的环回可以互相访问
5.减少路由条目数量,避免环路出现
三、实验步骤
1.配置IP
R1
r1int g0/0/0
r1-GigabitEthernet0/0/0ip add 12.0.0.1 30
May 29 2024 00:47:28-08:00 r1 %%01IFNET/4/LINK_STATE(l)1:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
r1-GigabitEthernet0/0/0int l 0
r1-LoopBack0ip add 192.168.1.1 24
r1-LoopBack0int l 1
r1-LoopBack1ip add 10.1.1.1 24
R2
r2int g0/0/0
r2-GigabitEthernet0/0/0ip add 12.0.0.2 30
May 29 2024 00:48:24-08:00 r2 %%01IFNET/4/LINK_STATE(l)0:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
r2-GigabitEthernet0/0/0int g0/0/1
r2-GigabitEthernet0/0/1ip add 172.16.1.1 30
May 29 2024 00:48:36-08:00 r2 %%01IFNET/4/LINK_STATE(l)1:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
r2-GigabitEthernet0/0/1int g0/0/2
r2-GigabitEthernet0/0/2ip add 172.16.1.22 30
May 29 2024 00:48:54-08:00 r2 %%01IFNET/4/LINK_STATE(l)2:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
r2-GigabitEthernet0/0/2int l 0
r2-LoopBack0ip add 2.2.2.2 32
r2-LoopBack0int l 1
r2-LoopBack1ip add 172.16.2.1 24
R3
r3int g0/0/0
r3-GigabitEthernet0/0/0ip add 172.16.1.2 30
May 29 2024 00:49:54-08:00 r3 %%01IFNET/4/LINK_STATE(l)0:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
r3-GigabitEthernet0/0/0int g0/0/1
r3-GigabitEthernet0/0/1ip add 172.16.1.5 30
May 29 2024 00:50:11-08:00 r3 %%01IFNET/4/LINK_STATE(l)1:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
r3-GigabitEthernet0/0/1int l 0
r3-LoopBack0ip add 3.3.3.3 32
r3-LoopBack0int l 1
r3-LoopBack1ip add 172.16.3.1 24
R4
r4int g0/0/0
r4-GigabitEthernet0/0/0ip add 172.16.1.6 30
May 29 2024 00:51:17-08:00 r4 %%01IFNET/4/LINK_STATE(l)0:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
r4-GigabitEthernet0/0/0int g0/0/1
r4-GigabitEthernet0/0/1ip add 172.16.1.9 30
May 29 2024 00:51:28-08:00 r4 %%01IFNET/4/LINK_STATE(l)1:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
r4-GigabitEthernet0/0/1int l 0
r4-LoopBack0ip add 4.4.4.4 32
r4-LoopBack0int l 1
r4-LoopBack1ip add 172.16.4.1 24
R5
r5int g0/0/0
r5-GigabitEthernet0/0/0ip add 172.16.1.21 30
May 29 2024 00:52:18-08:00 r5 %%01IFNET/4/LINK_STATE(l)0:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
r5-GigabitEthernet0/0/0int g0/0/1
r5-GigabitEthernet0/0/1ip add 172.16.1.18 30
May 29 2024 00:52:29-08:00 r5 %%01IFNET/4/LINK_STATE(l)1:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
r5-GigabitEthernet0/0/1int l 0
r5-LoopBack0ip add 5.5.5.5 32
r5-LoopBack0int l 1
r5-LoopBack1ip add 172.16.5.1 24
r6int g0/0/0
r6-GigabitEthernet0/0/0ip add 172.16.1.17 30
May 29 2024 00:53:33-08:00 r6 %%01IFNET/4/LINK_STATE(l)0:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
r6-GigabitEthernet0/0/0int g0/0/1
r6-GigabitEthernet0/0/1ip add 172.16.1.14 30
May 29 2024 00:53:45-08:00 r6 %%01IFNET/4/LINK_STATE(l)1:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
r6-GigabitEthernet0/0/1int l 0
r6-LoopBack0ip add 6.6.6.6 32
r6-LoopBack0int l 1
r6-LoopBack1ip add 172.16.6.1 24
R7
r7int g0/0/0
r7-GigabitEthernet0/0/0ip add 172.16.1.10 30
May 29 2024 00:54:41-08:00 r7 %%01IFNET/4/LINK_STATE(l)0:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
r7-GigabitEthernet0/0/0int g0/0/1
r7-GigabitEthernet0/0/1ip add 172.16.1.13 30
May 29 2024 00:54:53-08:00 r7 %%01IFNET/4/LINK_STATE(l)1:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
r7-GigabitEthernet0/0/1int g0/0/2
r7-GigabitEthernet0/0/2ip add 78.0.0.1 30
r7-GigabitEthernet0/0/2
May 29 2024 00:55:04-08:00 r7 %%01IFNET/4/LINK_STATE(l)2:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
r7-GigabitEthernet0/0/2int l 0
r7-LoopBack0ip add 7.7.7.7 32
r7-LoopBack0int l 1
r7-LoopBack1ip add 172.16.7.1 24
R8
r8int g0/0/0
r8-GigabitEthernet0/0/0ip add 78.0.0.2 30
May 29 2024 00:56:02-08:00 r8 %%01IFNET/4/LINK_STATE(l)0:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
r8-GigabitEthernet0/0/0int l 0
r8-LoopBack0ip add 192.168.2.1 24
r8-LoopBack0int l 1
r8-LoopBack1ip add 11.1.1.1 24
2.AS2内部配置ospf
R2
r2ospf 1 router-id 2.2.2.2
r2-ospf-1ar
r2-ospf-1area 0
r2-ospf-1-area-0.0.0.0network 2.2.2.2 0.0.0.0
r2-ospf-1-area-0.0.0.0network 172.16.2.0 0.0.0.255
r2-ospf-1-area-0.0.0.0network 172.16.1.1 0.0.0.0
r2-ospf-1-area-0.0.0.0network 172.16.1.22 0.0.0.0
R3
r3ospf 1 router-id 3.3.3.3
r3-ospf-1area 0
r3-ospf-1-area-0.0.0.0network 3.3.3.3 0.0.0.0
r3-ospf-1-area-0.0.0.0network 172.16.3.0 0.0.0.255
r3-ospf-1-area-0.0.0.0network 172.16.1.2 0.0.0.0
r3-ospf-1-area-0.0.0.0network 172.16.1.5 0.0.0.0
R4
r4ospf 1 router-id 4.4.4.4
r4-ospf-1area 0
r4-ospf-1-area-0.0.0.0network 4.4.4.4 0.0.0.0
r4-ospf-1-area-0.0.0.0network 172.16.4.0 0.0.0.0
r4-ospf-1-area-0.0.0.0network 172.16.1.6 0.0.0.0
r4-ospf-1-area-0.0.0.0network 172.16.1.9 0.0.0.0
R5
r5ospf 1 router-id 5.5.5.5
r5-ospf-1area 0
r5-ospf-1-area-0.0.0.0network 5.5.5.5 0.0.0.0
r5-ospf-1-area-0.0.0.0network 172.16.5.0 0.0.0.255
r5-ospf-1-area-0.0.0.0network 172.16.1.21 0.0.0.0
r5-ospf-1-area-0.0.0.0network 172.16.1.18 0.0.0.0
R6
r6ospf 1 router-id 6.6.6.6
r6-ospf-1area 0
r6-ospf-1-area-0.0.0.0network 6.6.6.6 0.0.0.0
r6-ospf-1-area-0.0.0.0network 172.16.6.0 0.0.0.255
r6-ospf-1-area-0.0.0.0network 172.16.1.17 0.0.0.0
r6-ospf-1-area-0.0.0.0network 172.16.1.14 0.0.0.0
R7
r7ospf 1 router-id 7.7.7.7
r7-ospf-1area 0
r7-ospf-1-area-0.0.0.0network 7.7.7.7 0.0.0.0
r7-ospf-1-area-0.0.0.0network 172.16.7.0 0.0.0.255
r7-ospf-1-area-0.0.0.0network 172.16.1.10 0.0.0.255
r7-ospf-1-area-0.0.0.0network 172.16.1.13 0.0.0.0
R1与R2建立EBGP
R1
r1bgp 1
r1-bgprouter-id 1.1.1.1
r1-bgppeer 12.0.0.2 as-number 2
R2
r2bgp 64512
r2-bgprouter-id 2.2.2.2
r2-bgpconfederation id 2
r2-bgppeer 12.0.0.1 as-number 1
R7与R8建立EBGP
r7bgp 64513
r7-bgprouter-id 2.2.2.2
r7-bgpconfederation id 2
r7-bgppeer 78.0.0.2 as-number 3
r8bgp 3
r8-bgprouter-id 8.8.8.8
r8-bgppeer 78.0.0.1 as-number 2
AS2区域中64512内R2/3/4之间建立联邦
R2
r2bgp 64512
r2-bgppeer 3.3.3.3 as-number 64512
r2-bgppeer 3.3.3.3 connect-interface LoopBack 0
r2-bgppeer 3.3.3.3 next-hop-local
R3
r3bgp 64512
r3-bgpconfederation id 2
r3-bgppeer 2.2.2.2 as-number 64512
r3-bgppeer 2.2.2.2 connect-interface LoopBack 0
r3-bgppeer 4.4.4.4 as-number 64512
r3-bgppeer 4.4.4.4 connect-interface LoopBack 0
R4
r4bgp 64512
r4-bgpconfederation id 2
r4-bgppeer 3.3.3.3 as-number 64512
r4-bgppeer 3.3.3.3 connect-interface LoopBack 0
AS2区域中64513内R5/6/7之间建立联邦
R5
r5bgp 64513
r5-bgpconfederation id 2
r5-bgppeer 6.6.6.6 as-number 64513
r5-bgppeer 6.6.6.6 connect-interface LoopBack 0
R6
r6bgp 64513
r6-bgpconfederation id 2
r6-bgppeer 7.7.7.7 as-number 64513
r6-bgppeer 7.7.7.7 connect-interface LoopBack 0
r6-bgppeer 5.5.5.5 as-number 64513
r6-bgppeer 5.5.5.5 connect-interface LoopBack 0
R7
r7bgp 6451
r7bgp 64513
r7-bgppeer 6.6.6.6 as-number 64513
r7-bgppeer 6.6.6.6 connect-interface LoopBack 0
r7-bgppeer 6.6.6.6 next-hop-local
R2与R5建立EBGP
R2
r2bgp 64512
r2-bgpconfederation peer-as 64513
r2-bgppeer 5.5.5.5 as-number 64513
r2-bgppeer 5.5.5.5 connect-interface LoopBack 0
r2-bgppeer 5.5.5.5 ebgp-max-hop
r2-bgppeer 5.5.5.5 next-hop-local
R5
r5bgp 64513
r5-bgpconfederation peer-as 64512
r5-bgppeer 2.2.2.2 as-number 64512
r5-bgppeer 2.2.2.2 connect-interface LoopBack 0
r5-bgppeer 2.2.2.2 ebgp-max-hop
R4与R7建立EBGP
R4
r4bgp 64512
r4-bgpconfederation peer-as 64513
r4-bgppeer 7.7.7.7 as-number 64513
r4-bgppeer 7.7.7.7 connect-interface LoopBack 0
r4-bgppeer 7.7.7.7 ebgp-max-hop
R7
r7bgp 64513
r7-bgpconfederation peer-as 64512
r7-bgppeer 4.4.4.4 as-number 64512
r7-bgppeer 4.4.4.4 connect-interface LoopBack 0
r7-bgppeer 4.4.4.4 ebgp-max-hop
r7-bgppeer 4.4.4.4 next-hop-local
6.在R3与R6上配置路由反射器用来打破IBGP的水平分割
R3
r3bgp 64512
r3-bgppeer 2.2.2.2 reflect-client
R6
r6bgp 64513
r6-bgppeer 7.7.7.7 reflect-client
将用户网段宣告进BGP
r1bgp 1
r1-bgpnetwork 10.1.1.0 24
r2bgp 64512
r2-bgpnetwork 172.16.2.0 24
r3bgp 64512
r3-bgpnetwork 172.16.3.0 24
r4bgp 64512
r4-bgpnetwork 172.16.4.0 24
r5bgp 64513
r5-bgpnetwork 172.16.5.0 24
r6bgp 64513
r6-bgpnetwork 172.16.6.0 24
r7bgp 64513
r7-bgpnetwork 172.16.7.0 24
r8bgp 3
r8-bgpnetwork 11.1.1.0 24
创建R1-R8虚拟隧道,使用GRE
R1
r1bgp 1
r1-bgpnetwork 10.1.1.0 24
r1-bgpint t 0/0/1
r1-Tunnel0/0/1ip add 192.168.3.1 24
r1-Tunnel0/0/1tunnel-protocol gre
r1-Tunnel0/0/1source 10.1.1.1
r1-Tunnel0/0/1destination 11.1.1.1
May 29 2024 01:45:22-08:00 r1 %%01IFNET/4/LINK_STATE(l)0:The line protocol IP
on the interface Tunnel0/0/1 has entered the UP state.
r1-Tunnel0/0/1
r1-Tunnel0/0/1Q
r1ip route-static 192.168.2.0 24 192.168.3.2
R8
r8bgp 3
r8-bgpnetwork 11.1.1.0 24
r8-bgpint t0/0/1
r8-Tunnel0/0/1ip add 192.168.3.2 24
r8-Tunnel0/0/1tunnel-protocol gre
r8-Tunnel0/0/1source 11.1.1.1
r8-Tunnel0/0/1destination 10.1.1.1
May 29 2024 01:46:40-08:00 r8 %%01IFNET/4/LINK_STATE(l)0:The line protocol IP
on the interface Tunnel0/0/1 has entered the UP state.
r8-Tunnel0/0/1Q
r8ip route-static 192.168.1.0 24 192.168.3.1
路由聚合
R2
r2ip route-static 172.16.0.0 21 NULL 0
r2bgp 64512
r2-bgpaggregate 172.16.0.0 21 detail-suppressed
R7
r7ip route-static 172.16.0.0 21 NULL 0
r7bgp 64513
r7-bgpaggregate 172.16.0.0 21 detail-suppressed
四、验证

