一:实验要求

二:实现过程
(一)配置IP地址:
AR1:
[AR1]int g0/0/0
 [AR1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
 [AR1-GigabitEthernet0/0/0]int l0
 [AR1-LoopBack0]ip add 172.16.0.1 32
 [AR1-LoopBack0]int l1
 [AR1-LoopBack1]ip add 192.168.1.1 24
  
AR2:
[AR2]int g0/0/0
 [AR2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
 May 12 2024 16:36:47-08:00 AR2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  on the interface GigabitEthernet0/0/0 has entered the UP state. 
 [AR2-GigabitEthernet0/0/0]int l0
 [AR2-LoopBack0]ip add 172.16.0.2 32
 [AR2-LoopBack0]int g0/0/1
 [AR2-GigabitEthernet0/0/1]ip add 172.16.1.2 30
 [AR2-GigabitEthernet0/0/1]
 May 12 2024 16:37:36-08:00 AR2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
  on the interface GigabitEthernet0/0/1 has entered the UP state. 
 [AR2-GigabitEthernet0/0/1]int g0/0/2
 [AR2-GigabitEthernet0/0/2]ip add 172.16.1.21 30
  
AR3:
[AR3]int g0/0/0
 [AR3-GigabitEthernet0/0/0]ip add 172.16.1.1 30
 May 12 2024 16:40:04-08:00 AR3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  on the interface GigabitEthernet0/0/0 has entered the UP state. 
 [AR3-GigabitEthernet0/0/0]int g0/0/1
 [AR3-GigabitEthernet0/0/1]ip add 172.16.1.5 30
 May 12 2024 16:40:24-08:00 AR3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
  on the interface GigabitEthernet0/0/1 has entered the UP state. 
 [AR3-GigabitEthernet0/0/1]int l0
 [AR3-LoopBack0]ip add 172.16.0.3 32
 [AR3-LoopBack0]int l1
 [AR3-LoopBack1]ip add 172.16.3.3 24
 [AR3-LoopBack1]
AR4:
[AR4]int g0/0/0
 [AR4-GigabitEthernet0/0/0]ip add 172.16.1.6 30
 May 12 2024 16:42:19-08:00 AR4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  on the interface GigabitEthernet0/0/0 has entered the UP state. 
 [AR4-GigabitEthernet0/0/0]int g0/0/1
 [AR4-GigabitEthernet0/0/1]ip add 172.16.1.9 30
 May 12 2024 16:43:08-08:00 AR4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
  on the interface GigabitEthernet0/0/1 has entered the UP state. 
 [AR4-GigabitEthernet0/0/1]int l0
 [AR4-LoopBack0]ip add 172.16.0.4 32
 [AR4-LoopBack0]int l1
 [AR4-LoopBack1]ip add 172.16.4.4 24
  
AR5:
[AR5]int g0/0/0
 [AR5-GigabitEthernet0/0/0]ip add 172.16.1.22 30
 May 12 2024 16:44:38-08:00 AR5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  on the interface GigabitEthernet0/0/0 has entered the UP state. 
 [AR5-GigabitEthernet0/0/0]int g0/0/1
 [AR5-GigabitEthernet0/0/1]ip add 172.16.1.17 30
 May 12 2024 16:45:00-08:00 AR5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
  on the interface GigabitEthernet0/0/1 has entered the UP state. 
 [AR5-GigabitEthernet0/0/1]int l0
 [AR5-LoopBack0]ip add 172.16.0.5 32
 [AR5-LoopBack0]int l1
 [AR5-LoopBack1]ip add 172.16.5.5 24
  
AR6:
[AR6]int g0/0/0
 [AR6-GigabitEthernet0/0/0]ip add 172.16.1.18 30
 May 12 2024 16:46:43-08:00 AR6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  on the interface GigabitEthernet0/0/0 has entered the UP state. 
 [AR6-GigabitEthernet0/0/0]int g0/0/1
 [AR6-GigabitEthernet0/0/1]ip add 172.16.1.13 30
 May 12 2024 16:47:03-08:00 AR6 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
  on the interface GigabitEthernet0/0/1 has entered the UP state. 
 [AR6-GigabitEthernet0/0/1]int l0
 [AR6-LoopBack0]ip add 172.16.0.6 32
 [AR6-LoopBack0]int l1
 [AR6-LoopBack1]ip add 172.16.6.6 24
  
AR7:
[AR7]int g0/0/0
 [AR7-GigabitEthernet0/0/0]ip add 172.16.1.14 30
 May 12 2024 16:48:42-08:00 AR7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
  on the interface GigabitEthernet0/0/0 has entered the UP state. 
 [AR7-GigabitEthernet0/0/0]int g0/0/1
 [AR7-GigabitEthernet0/0/1]ip add 172.16.1.10 30
 May 12 2024 16:48:58-08:00 AR7 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
  on the interface GigabitEthernet0/0/1 has entered the UP state. 
 [AR7-GigabitEthernet0/0/1]int g0/0/2
 [AR7-GigabitEthernet0/0/2]ip add 34.1.1.7 24
 [AR7-GigabitEthernet0/0/2]
 May 12 2024 16:49:23-08:00 AR7 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
  on the interface GigabitEthernet0/0/2 has entered the UP state. 
 [AR7-GigabitEthernet0/0/2]int l0
 [AR7-LoopBack0]ip add 172.16.0.7 32
 [AR7-LoopBack0]int l1
 [AR7-LoopBack1]ip add 172.16.7.7 24
  
AR8:
[Huawei]int g0/0/0
 [Huawei-GigabitEthernet0/0/0]ip add 34.1.1.8 24
 May 12 2024 16:50:47-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
  IP on the interface GigabitEthernet0/0/0 has entered the UP state. 
 [Huawei-GigabitEthernet0/0/0]int l0
 [Huawei-LoopBack0]ip add 172.16.0.8 32
 [Huawei-LoopBack0]int l1
 [Huawei-LoopBack1]ip add 192.168.2.8 24
  
(二)OSPF宣告:
AR2:
[AR2]ospf 1 router-id 2.2.2.2
 [AR2-ospf-1]a 0
 [AR2-ospf-1-area-0.0.0.0]ne 172.16.1.0 0.0.0.3
 [AR2-ospf-1-area-0.0.0.0]ne 172.16.1.20 0.0.0.3
 [AR2-ospf-1-area-0.0.0.0]ne 172.16.0.2 0.0.0.0
  
AR3:
[AR3]ospf 1 router-id 3.3.3.3
 [AR3-ospf-1]a 0
 [AR3-ospf-1-area-0.0.0.0]ne 172.16.1.0 0.0.0.3
 [AR3-ospf-1-area-0.0.0.0]ne 172.16.1.4 0.0.0.3
 [AR3-ospf-1-area-0.0.0.0]ne 172.16.0.3 0.0.0.0
 [AR3-ospf-1-area-0.0.0.0]ne 172.16.3.0 0.0.0.255
  
AR4:
[AR4]ospf 1 router-id 4.4.4.4
 [AR4-ospf-1]a 0
 [AR4-ospf-1-area-0.0.0.0]ne 172.16.1.4 0.0.0.3
 [AR4-ospf-1-area-0.0.0.0]ne 172.16.1.8 0.0.0.3
 [AR4-ospf-1-area-0.0.0.0]ne 172.16.0.4 0.0.0.0
 [AR4-ospf-1-area-0.0.0.0]ne 172.16.4.0 0.0.0.255
  
AR5:
[AR5]ospf 1 router-id 5.5.5.5
 [AR5-ospf-1]a 0
 [AR5-ospf-1-area-0.0.0.0]ne 172.16.1.20 0.0.0.3
 [AR5-ospf-1-area-0.0.0.0]ne 172.16.1.16 0.0.0.3
 [AR5-ospf-1-area-0.0.0.0]ne 172.16.0.5 0.0.0.0
 [AR5-ospf-1-area-0.0.0.0]ne 172.16.5.0 0.0.0.255
  
AR6:
[AR6]ospf 1 router-id 6.6.6.6
 [AR6-ospf-1]a 0
 [AR6-ospf-1-area-0.0.0.0]ne 172.16.1.16 0.0.0.3
 [AR6-ospf-1-area-0.0.0.0]ne 172.16.1.12 0.0.0.3
 [AR6-ospf-1-area-0.0.0.0]ne 172.16.0.6 0.0.0.0
 [AR6-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255
  
AR7:
[AR7]ospf 1 router-id 7.7.7.7
 [AR7-ospf-1]a 0
 [AR7-ospf-1-area-0.0.0.0]ne 172.16.1.12 0.0.0.3
 [AR7-ospf-1-area-0.0.0.0]ne 172.16.1.8 0.0.0.3
 [AR7-ospf-1-area-0.0.0.0]ne 172.16.0.7 0.0.0.0
 [AR7-ospf-1-area-0.0.0.0]ne 172.16.7.0 0.0.0.255
  
(三)BGP配置:
AR1:
[AR1]bgp 1
 [AR1-bgp]peer 12.1.1.2 as 2
  
AR2:
[AR2]bgp 64512
 [AR2-bgp]con    
 [AR2-bgp]confederation id 2
 [AR2-bgp]confederation peer-as 64513
 [AR2-bgp]peer 12.1.1.1 as 1
 [AR2-bgp]peer 172.16.0.3 as 64512
 [AR2-bgp]peer 172.16.0.3 connect-interface l0
 [AR2-bgp]peer 172.16.0.3 next-hop-local
 [AR2-bgp]peer 172.16.1.22 as-number 64513
 [AR2-bgp]peer 172.16.1.22 n    
 [AR2-bgp]peer 172.16.1.22 next-hop-local
  
AR3:
[AR3]bgp 64512
 [AR3-bgp]con    
 [AR3-bgp]confederation id 2
 [AR3-bgp]peer 172.16.0.2 as 64512
 [AR3-bgp]peer 172.16.0.2 con    
 [AR3-bgp]peer 172.16.0.2 connect-interface l0
 [AR3-bgp]peer 172.16.0.4 as 64512
 [AR3-bgp]peer 172.16.0.4 connect-interface l0
  
AR4:
[AR4]bgp 64512
 [AR4-bgp]peer 172.16.0.3 as 64512
  
AR5:
[AR5]bgp 64513
 [AR5-bgp]con    
 [AR5-bgp]confederation id 2
 [AR5-bgp]con    
 [AR5-bgp]confederation peer-as 64512
 [AR5-bgp]peer 172.16.1.21 as-number 64512
 [AR5-bgp]peer 172.16.1.21 next-hop-local
 [AR5-bgp]
 [AR5-bgp]peer 172.16.0.6 as 64513
 [AR5-bgp]peer 172.16.0.6 con    
 [AR5-bgp]peer 172.16.0.6 connect-interface l0
 [AR5-bgp]peer 172.16.0.6 next-hop-local
  
AR6:
[AR6]bgp 64513
 [AR6-bgp]peer 172.16.0.5 as 64513
 [AR6-bgp]peer 172.16.0.5 con    
 [AR6-bgp]peer 172.16.0.5 connect-interface l0
 [AR6-bgp]peer 172.16.0.5 next-hop-local
  
[AR6-bgp]peer 172.16.0.7 as 64513
 [AR6-bgp]peer 172.16.0.7 next-hop-local
  
AR7:
[AR7]bgp 64513
 [AR7-bgp]peer 172.16.0.6 as 64513
 [AR7-bgp]peer 172.16.0.6 next-hop-local
 [AR7-bgp]peer 172.16.0.6 co    
 [AR7-bgp]peer 172.16.0.6 connect-interface l0
 [AR7-bgp]peer 172.16.0.8 as 3
  
AR8:
[AR8]bgp 3
 [AR8-bgp]peer 172.16.0.7 as 2
  
(四)将AR3和AR6设置为反射器:
AR3:
[AR3]bgp 64512
 [AR3-bgp]peer 172.16.0.2 re    
 [AR3-bgp]peer 172.16.0.2 reflect-client 
 [AR3-bgp]peer 172.16.0.4 re    
 [AR3-bgp]peer 172.16.0.4 reflect-client 
  
AR6:
[AR6]bgp 64513
 [AR6-bgp]peer 172.16.0.5 re    
 [AR6-bgp]peer 172.16.0.5 reflect-client 
 [AR6-bgp]peer 172.16.0.7 re    
 [AR6-bgp]peer 172.16.0.7 reflect-client 
  
目前已达到AR2--AR7无障碍通信:

(五)配置VPN隧道:
AR1:
[AR1]int t0/0/0
 [AR1-Tunnel0/0/0]ip add 10.1.1.1 24
 [AR1-Tunnel0/0/0]tu    
 [AR1-Tunnel0/0/0]tunnel-protocol gre
 [AR1-Tunnel0/0/0]
 [AR1-Tunnel0/0/0]source 12.1.1.1
 [AR1-Tunnel0/0/0]de    
 [AR1-Tunnel0/0/0]description 34.1.1.8 
  
AR8:
[AR8]int t0/0/0
 [AR8-Tunnel0/0/0]ip add 10.1.1.8 24
 [AR8-Tunnel0/0/0]t    
 [AR8-Tunnel0/0/0]tu    
 [AR8-Tunnel0/0/0]tunnel-protocol gre
 [AR8-Tunnel0/0/0]source 34.1.1.8
 [AR8-Tunnel0/0/0]destination 12.1.1.1