要求:
1.AS1存在两个环回,一个地址为192.168.1.0/24该地址不能在任何协议中宣告
AS3中存在两个环回,一个地址为192.168.2.0/24该地址不能在任何协议中宣告,
最终要求这两个环回可以互相通讯
2.整个AS2的Ip地址为172.16.0.8/16,请合理划分
3.AS间的骨干链路IP地址随意定制
4.使用BGP协议让整个网络所有设备的环回可以互相访问
5.减少路由条自数量,避免环路出现
效果图:
R1的bgp路由表内有R2-R8的环回(用于bgp建邻的环回)和192.168.2.0/24--R8的另一个环回
R1成功ping通其他路由环回
代码:
R1
bgp 100
router-id 1.1.1.1
peer 12.0.0.2 as-number 200 #AS为200
network 1.1.1.1 32
ip route-static 192.168.2.0 24 Tunnel0/0/0
interface Tunnel0/0/0 #环回不能宣告就只能vpn隧道互相通信了
ip address 192.168.3.1 24
tunnel-protocol gre
source 1.1.1.1 #用R1环回做source源,及时G0/0/0物理接口ip换了也不用改
destination 8.8.8.8 #如果destinnation打错接口表的protocol会显示down状态
R2
bgp 64512
router-id 2.2.2.2
confederation id 200 #先声明自己属于大AS号200
confederation peer-as 64513 #联邦建邻要先指明对端联邦的AS号
peer 12.0.0.1 as-number 100 #指定R1的物理链路建邻
peer 172.16.0.3 as-number 64512 #指定R3的环回建邻
peer 172.16.0.3 connect-interface LoopBack0 #将与R3建邻接口由R2物理链路改为R2环回
peer 172.16.0.5 as-number 64513 #指定R5的环回建邻
peer 172.16.0.5 ebgp-max-hop 255 #R5为联邦ebgp,环回建邻要将跳数从默认1改到至少为2
peer 172.16.0.5 connect-interface LoopBack0
import-route ospf 1 #向R1重发布OSPF路由表
peer 172.16.0.3 next-hop-local #下一跳改成R2环回
peer 172.16.0.5 next-hop-local
R3
bgp 64512
router-id 3.3.3.3
confederation id 200
peer 172.16.0.2 as-number 64512
peer 172.16.0.2 connect-interface LoopBack0
peer 172.16.0.4 as-number 64512
peer 172.16.0.4 connect-interface LoopBack0
peer 172.16.0.2 reflect-client #R3将自己视为反射器,R2视为客户
peer 172.16.0.4 reflect-client
#后面注释同上
R4
bgp 64512
router-id 4.4.4.4
confederation id 200
confederation peer-as 64513
peer 172.16.0.3 as-number 64512
peer 172.16.0.3 connect-interface LoopBack0
peer 172.16.0.7 as-number 64513
peer 172.16.0.7 ebgp-max-hop 255
peer 172.16.0.7 connect-interface LoopBack0
R5
bgp 64513
router-id 5.5.5.5
confederation id 200
confederation peer-as 64512
peer 172.16.0.2 as-number 64512
peer 172.16.0.2 ebgp-max-hop 255
peer 172.16.0.2 connect-interface LoopBack0
peer 172.16.0.6 as-number 64513
peer 172.16.0.6 connect-interface LoopBack0
R6
bgp 64513
router-id 6.6.6.6
confederation id 200
peer 172.16.0.5 as-number 64513
peer 172.16.0.5 connect-interface LoopBack0
peer 172.16.0.7 as-number 64513
peer 172.16.0.7 connect-interface LoopBack0
peer 172.16.0.5 reflect-client
peer 172.16.0.7 reflect-client
R7
bgp 64513
router-id 7.7.7.7
confederation id 200
confederation peer-as 64512
peer 78.0.0.2 as-number 300
peer 172.16.0.4 as-number 64512
peer 172.16.0.4 ebgp-max-hop 255
peer 172.16.0.4 connect-interface LoopBack0
peer 172.16.0.6 as-number 64513
peer 172.16.0.6 connect-interface LoopBack0
import-route ospf 1
peer 172.16.0.4 next-hop-local
peer 172.16.0.6 next-hop-local
R8
bgp 300
router-id 8.8.8.8
peer 78.0.0.1 as-number 200
network 8.8.8.8 24
ip route-static 192.168.1.0 24 Tunnel0/0/0
interface Tunnel0/0/0
ip address 192.168.3.2 255.255.255.0
tunnel-protocol gre
source 8.8.8.8
destination 1.1.1.1