一:拓撲圖
?二:需求分析
1,AS1存在兩個環回,一個地址為192.168.1.0/24該地址不能在任何協議中宣告,AS3中存在倆個環回,一個地址為192.168.2.0/24該地址不能在任何協議中宣告,最終要求這兩個環回可以互相通訊
- 使用VPN技術,在R1和R8之間搭建一條虛擬鏈路,約等于直連,此時無需宣告。
2,整個AS2的IP地址為172.16.0.0/16,請合理劃分
- 為了便于管理,使用172.16.0.0/24進行分配:????????
- 172.16.0.0/25---骨干鏈路;172.16.1.0/25---環回地址
- 骨干鏈路只需要兩個地址
- 172.16.0.0/30:R2--R3
- 172.16.0.4/30:R3--R4
- 172.16.0.8/30:R4--R5
- 172.16.0.12/30:R5--R6
- 172.16.0.16/30:R6--R7
- 172.16.0.20/30:R7--R2
- 環回地址只需要一個地址
- 172.16.1.0/30:R2
- 172.16.1.4/30:R3
- 172.16.1.8/30:R4
- 172.16.1.12/30:R5
- 172.16.1.16/30:R6
- 172.16.1.20/30:R7
3,使用BGP協議讓整個網絡所有設備的環回可以互相訪問
- 結合 IGP協議,BGP協議,聯邦,反射器實現互相訪問
4,減少路由條目數量,避免環路出現
- 在R2和R7上做路由匯總
三:具體配置
1.配置IP
R1:
GigabitEthernet0/0/0 12.0.0.1/24 up up
LoopBack0 192.168.1.1/24 up up(s)
LoopBack1 10.1.1.1/24 up up(s)
R2:
GigabitEthernet0/0/0 12.0.0.2/24 up up
GigabitEthernet0/0/1 172.16.0.1/30 up up
GigabitEthernet0/0/2 172.16.0.21/30 up up
LoopBack0 172.16.1.1/30 up up(s)
R3:
GigabitEthernet0/0/0 172.16.0.2/30 up up
GigabitEthernet0/0/1 172.16.0.5/30 up up
LoopBack0 172.16.1.5/30 up up(s)
R4:
GigabitEthernet0/0/0 172.16.0.6/30 up up
GigabitEthernet0/0/1 172.16.0.9/30 up up
LoopBack0 172.16.1.9/30 up up(s)
R5:
GigabitEthernet0/0/0 172.16.0.22/30 up up
GigabitEthernet0/0/1 172.16.0.17/30 up up
LoopBack0 172.16.1.21/30 up up(s)
R6:
GigabitEthernet0/0/0 172.16.0.18/30 up up
GigabitEthernet0/0/1 172.16.0.13/30 up up
LoopBack0 172.16.1.17/30 up up(s)
R7;
GigabitEthernet0/0/0 172.16.0.10/30 up up
GigabitEthernet0/0/1 172.16.0.14/30 up up
GigabitEthernet0/0/2 78.0.0.7/24 up up
LoopBack0 172.16.1.13/30 up up(s)
R8:
GigabitEthernet0/0/0 78.0.0.8/24 up up
LoopBack0 192.168.2.1/24 up up(s)
LoopBack1 11.1.1.1/24 up up(s)
2.配置SOPF
R2
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]net 172.16.0.0 0.0.255.255
R3
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]net 172.16.0.0 0.0.255.255
R4
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]a 0
[R4-ospf-1-area-0.0.0.0]net 172.16.0.0 0.0.255.255
R5
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]net 172.16.0.0 0.0.255.255
R6
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]net 172.16.0.0 0.0.255.255
R7
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]net 172.16.0.0 0.0.255.255
3.配置BGP
1)聯邦配置
R1:直連配置EBGP
[r1]bgp
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.0.0.2 as-number 2
R2:
--- 前期準備 ---
[R2]bgp 64512
[R2-bgp]router-id 2.2.2.2
[R2-bgp]confederation id 2--- 與R2直連配置EBGP對等體 ---
[R2-bgp]peer 12.0.0.1 as 1--- 與R3環回配置IBGP對等體 ---
[R2-bgp]peer 172.16.1.5 as-number 64512
[R2-bgp]peer 172.16.1.5 connect-interface l0 --- 用環回接口連接
[R2-bgp]peer 172.16.1.5 next-hop-local --- 通過本地接口轉發--- 與R5環回配置EBGP對等體 ---
[R2-bgp]confederation peer-as 64513 --- 指定鄰居所屬的AS 號
[R2-bgp]peer 172.16.1.21 as 64513
[R2-bgp]peer 172.16.1.21 connect-interface LoopBack 0
[r2-bgp]peer 172.16.1.21 ebgp-max-hop --- EBGP建鄰要改TTL值
R3
--- 前期準備 ---
[r3]bgp 64512
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 2--- 與R2建立鄰居 ---
[r3-bgp]peer 172.16.1.1 as-number 64512
[r3-bgp]peer 172.16.1.1 connect-interface LoopBack 0--- 與R4建立鄰居 ---
[r3-bgp]peer 172.16.1.9 as-number 64512
[r3-bgp]peer 172.16.1.9 connect-interface LoopBack 0
R4
--- 前期準備 ---
[r4]bgp 64512
[r4-bgp]router-id 4.4.4.4
[r4-bgp]confederation id 2--- 與R3連接 ---
[r4-bgp]peer 172.16.1.5 as-number 64512
[r4-bgp]peer 172.16.1.5 connect-interface LoopBack 0--- 與R7連接 ---
[r4-bgp]confederation peer-as 64513
[r4-bgp]peer 172.16.1.13 as-number 64513
[r4-bgp]peer 172.16.1.13 connect-interface LoopBack 0
[r4-bgp]peer 172.16.1.13 ebgp-max-hop
R5
[r5]bgp 64513
[r5-bgp]router-id 5.5.5.5
[r5-bgp]confederation id 2[r5-bgp]confederation peer-as 64512
[r5-bgp]peer 172.16.1.1 as-number 64512
[r5-bgp]peer 172.16.1.1 connect-interface LoopBack 0
[r5-bgp]peer 172.16.1.1 ebgp-max-hop [r5-bgp]peer 172.16.1.17 as-number 64513
[r5-bgp]peer 172.16.1.17 connect-interface LoopBack 0
R6
[r6]bgp 64513
[r6-bgp]router-id 6.6.6.6
[r6-bgp]confederation id 2[r6-bgp]peer 172.16.1.21 as-number 64513
[r6-bgp]peer 172.16.1.21 connect-interface LoopBack 0[r6-bgp]peer 172.16.1.13 as-number 64513
[r6-bgp]peer 172.16.1.13 connect-interface LoopBack 0
R7
[r7]bgp 64513
[r7-bgp]router-id 7.7.7.7
[r7-bgp]confederation id 2[r7-bgp]peer 172.16.1.17 as-number 64513
[r7-bgp]peer 172.16.1.17 connect-interface LoopBack 0
[r7-bgp]peer 172.16.1.17 next-hop-local[r7-bgp]confederation peer-as 64512
[r7-bgp]peer 172.16.1.9 as-number 64512
[r7-bgp]peer 172.16.1.9 connect-interface LoopBack 0
[r7-bgp]peer 172.16.1.9 next-hop-local
[r7-bgp]peer 172.16.1.9 ebgp-max-hop [r7]bgp 64513
[r7-bgp]peer 78.0.0.8 as-number 3
R8
[r8]bgp 3
[r8-bgp]router-id 8.8.8.8
[r8-bgp]peer 78.0.0.7 as-number 2
2)配置反射器
? ? ? ? R2收到的路由傳給R3和R5,但是R3因為水平分割規則,無法傳給R4,故配置R4為R3的客戶端。
R3
[r3]bgp 64512
[r3-bgp]peer 172.16.1.9 reflect-client
同理:
R6
[r6]bgp 64513
[r6-bgp]peer 172.16.1.21 reflect-client
3)測試
?
4.路由宣告
1)路由宣告
R1與R8直接宣告
R1
[r1]bgp 1
[r1-bgp]network 10.1.1.0 24
R8?
[r8]bgp 3
[r8-bgp]network 11.1.1.0 24
R2-R7通過在BGP重發布
[r2]bgp 64512
[r2-bgp]import-route ospf 1
5.配置VPN
R1
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 192.168.3.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre
[r1-Tunnel0/0/0]source 10.0.0.1
[r1-Tunnel0/0/0]destination 11.1.1.1
R8
[r8]interface Tunnel 0/0/0
[r8-Tunnel0/0/0]ip address 192.168.3.2 24
[r8-Tunnel0/0/0]tunnel-protocol gre
[r8-Tunnel0/0/0]source 11.1.1.1
[r8-Tunnel0/0/0]destination 10.1.1.1
?補充路由
[r1]ip route-static 192.168.2.0 24 192.168.3.2
[r8]ip route-static 192.168.1.0 24 192.168.3.1
四:測試
?
全網可達,試驗結束。?
?