一,首先根据要求进行子网划分
172.16.0.0/16
172.16.0.0/24 ---P2P网络
172.16.1.0/24 ---MA网络
172.16.1.0/29
172.16.1.8/29
172.16.1.16/29
172.16.1.24/29
172.16.1.32/29
172.16.1.40/29
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环回
二,给所有路由器配置IP地址。
R1
R2
R3
R4
R5
R6
R7
R8
三,AS 2内部启用OSPF协议
R2---R7
ospf 1 router-id x.x.x.x
area 0.0.0.0
network 172.16.0.0 0.0.255.255
四,启用BGP协议
R1:
[r1]bgp 1 ---启用AS 1
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.0.0.2 as-number 2
R2:
[r2]bgp 64512 ---启用小号64512
[r2-bgp]router-id 2.2.2.2
[r2-bgp]confederation id 2 ---声明自己的大号
[r2-bgp]confederation peer-as 64513 ---指定建立EBGP对等体对方的小号
[r2-bgp]peer 12.0.0.1 as-number 1
[r2-bgp]peer 172.16.3.0 as-number 64512
[r2-bgp]peer 172.16.3.1 connect-interface LoopBack 0
[r2-bgp]peer 172.16.5.1 as-number 64513
[r2-bgp]peer 172.16.5.1 connect-interface l 0
[r2-bgp]peer 172.16.5.1 ebgp-max-hop ---必须修改TTL值
R3:
bgp 64512
router-id 3.3.3.3
confederation id 2
peer 172.16.2.1 as-number 64512
peer 172.16.2.1 connect-interface LoopBack0
peer 172.16.4.1 as-number 64512
peer 172.16.4.1 connect-interface LoopBack0
R4:
bgp 64512
router-id 4.4.4.4
confederation id 2
confederation peer-as 64513
peer 172.16.3.1 as-number 64512
peer 172.16.3.1 connect-interface LoopBack0
peer 172.16.7.1 as-number 64513
peer 172.16.7.1 ebgp-max-hop 255
peer 172.16.7.1 connect-interface LoopBack0
R5:
bgp 64513
router-id 5.5.5.5
confederation id 2
confederation peer-as 64512
peer 172.16.2.1 as-number 64512
peer 172.16.2.1 ebgp-max-hop 255
peer 172.16.2.1 connect-interface LoopBack0
peer 172.16.6.1 as-number 64513
peer 172.16.6.1 connect-interface LoopBack0
R6:
bgp 64513
router-id 6.6.6.6
confederation id 2
peer 172.16.5.1 as-number 64513
peer 172.16.5.1 connect-interface LoopBack0
peer 172.16.7.1 as-number 64513
peer 172.16.7.1 connect-interface LoopBack0
R7:
bgp 64513
router-id 7.7.7.7
confederation id 2
confederation peer-as 64512
peer 78.0.0.2 as-number 3
peer 172.16.4.1 as-number 64512
peer 172.16.4.1 ebgp-max-hop 255
peer 172.16.4.1 connect-interface LoopBack0
peer 172.16.6.1 as-number 64513
peer 172.16.6.1 connect-interface LoopBack0
R8:
bgp 3
router-id 8.8.8.8
peer 78.0.0.1 as-number 2
五,宣告路由。
(一)宣告
[r1]bgp 1
[r1-bgp]network 10.0.0.0 24
[r8]bgp 3
[r8-bgp]network 11.0.0.0 24
(二)修改下一跳
[r2-bgp]peer 172.16.3.1 next-hop-local
[r2-bgp]peer 172.16.5.1 next-hop-local
[r7-bgp]peer 172.16.4.1 next-hop-local
[r7-bgp]peer 172.16.6.1 next-hop-local
(三)创建路由反射器
[r3-bgp]peer 172.16.2.1 reflect-client ---指定R2为自己的客户,自己为RR
[r6-bgp]peer 172.16.5.1 reflect-client ---指定R5为自己的客户,自己为RR
六,使用BGP协议让整个网络所有设备的环回可以互相访问
[r2]ip route-static 172.16.0.0 21 NULL 0
[r2]bgp 64512
[r2-bgp]network 172.16.0.0 21
[r7]ip route-static 172.16.0.0 21 NULL 0
[r7]bgp 64513
[r7-bgp]network 172.16.0.0 21
七,使192.168.1.0 与 192.168.2.0 互相通信。
[r1]int t0/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.0.0.1
[r8]int t0/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.0.0.1
[r8-Tunnel0/0/0]destination 10.0.0.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