实验要求
1、AS1中存在两个环回,一个地址为192.168.1.0/24,该地址不能在任何协议中宣告;
AS3中存在两个环回一个地址为192.168.2.0/24,该地址不能在任何协议中宣告,最终要求这 两个环回可以ping通;
2、R1-R8的建邻环回用X.X.X.X/32表示
3、整个AS2的IP地址为172.16.0.0/16,R3-R7上各有一个业务网段,请合理划分; 并且其内部配 置OSPF协议
4、As间的骨干链路IP地址随意定制;
5、使用Bgp协议让整个网络所有设备的环回可以互相访问;
6、减少路由条目数量,避免环路出现;
划分网段
配置IP地址
r1
r2
r3
r4
r5
r6
r7
r8
ospf协议
r2
r3
r4
r5
r6
r7
接下来我们BGP建邻:我这里使用物理口,因为不想改更新源,还有在联盟上EBGP路由器的TTL值为最大
R1:
[R1]bgp 1
[R1-bgp]peer 12.1.1.2 as-number 2
R2:
[R2]bgp 64512 #先进入自己私有AS中
[R2-bgp]confederation id 2 #申明自己大号AS
[R2-bgp]confederation peer-as 64513 #申明子AS的邻居
[R2-bgp]peer 12.1.1.1 as-number 1
[R2-bgp]peer 172.16.1.2 as 64512
[R2-bgp]peer 172.16.1.2 next-hop-local
[R2-bgp]peer 172.16.1.22 as 64513
[R2-bgp]peer 172.16.1.22 next-hop-local
R3:
[R3]bgp 64512
[R3-bgp]confederation id 2
[R3-bgp]peer 172.16.1.1 as 64512
[R3-bgp]peer 172.16.1.1 next-hop-local
[R3-bgp]peer 172.16.1.6 as 64512
[R3-bgp]peer 172.16.1.6 next-hop-local
R4:
[R4]bgp 64512
[R4-bgp]confederation id 2
[R4-bgp]peer 172.16.1.5 as 64512
[R4-bgp]peer 172.16.1.5 next-hop-local
R5:
[R5]bgp 64513
[R5-bgp]confederation id 2
[R5-bgp]confederation peer-as 64512
[R5-bgp]peer 172.16.1.21 as 64512
[R5-bgp]peer 172.16.1.21 next-hop-local
[R5-bgp]peer 172.16.1.18 as 64513
[R5-bgp]peer 172.16.1.18 next-hop-local
R6:
[R6]bgp 64513
[R6-bgp]confederation id 2
[R6-bgp]peer 172.16.1.17 as 64513
[R6-bgp]peer 172.16.1.17 next-hop-local
[R6-bgp]peer 172.16.1.14 as 64513
[R6-bgp]peer 172.16.1.14 next-hop-local
R7:
[R7]bgp 64513
[R7-bgp]confederation id 2
[R7-bgp]peer 78.1.1.2 as 3
[R7-bgp]peer 78.1.1.2 next-hop-local
[R7-bgp]peer 172.16.1.13 as 64513
[R7-bgp]peer 172.16.1.13 next-hop-local
[R7-bgp]peer 172.16.1.9 as 64512
[R7-bgp]peer 172.16.1.9 next-hop-local
R8:
[R8]bgp 3
[R8-bgp]peer 78.1.1.1 as 2
这时我们ping不通,我们查看bgp的路由表,发现:
R1:(只有自己宣告的)
R2:(因为在R6处IBGP水平分割传不到R5上所以8.8.8.8在R5上就学不到了,因此AS64512中的其他设备都学不到)
R3:(能学到1.1.1.1)
R4:(IBGP水平分割,1.1.1.1传不到R4)
R5:(EBGP传到R5)
R6:(两边都是IBGP传到R6所以它什么都能学到)
R7:(只能学到8.8.8.8)
R8:(自己宣告进去的)
这时我们需要在R3和R6上使用路由过反射:
R3:
[R3]bgp 64512
[R3-bgp]peer 172.16.1.6 reflect-client
R6:
[R6]bgp 64513
[R6-bgp]peer 172.16.1.17 reflect-client
R1的环回-----ping-----R8的环回
5.使用Bgp协议让整个网络所有设备的环回可以互相访问;
6、减少路由条目数量,避免环路出现;
我们宣告所有设备(除了R1和R8的不让宣告)的业务环回:我们宣告时用大网段,减少路由条目,就不手工汇总了 ,顺便做个防环:
在这里我们在R2和R7上做,其他的不用因为除了R1和R8其他设备都是反射过去的:
R2:
[R2]bgp 64512
[R2-bgp]net 172.16.0.0 21 #宣告大网段在bgp下
[R2]ip route-static 172.16.0.0 21 NULL 0 #防环
R6:
[R7-bgp]net 172.16.0.0 21
[R7-bgp]q
[R7]ip route-static 172.16.0.0 16 NULL 0
大网段宣告进去了,可以试一下业务网段通:
如下图:R1的bgp路由表都学到了,而且是汇总后的,再使用R1的环回去ping其他的业务网段通了
1、AS1中存在两个环回,一个地址为192.168.1.0/24,该地址不能在任何协议中宣告;
AS3中存在两个环回一个地址为192.168.2.0/24,该地址不能在任何协议中宣告,最终要求这 两个环回可以ping通;
思路:这路不宣告的情况下让R1和R8的业务网段互通我们使用VPN的gre完成
R1:
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 192.168.3.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]source 1.1.1.1
[R1-Tunnel0/0/0]destination 8.8.8.8
[R1]ip route-static 192.168.2.0 24 192.168.3.2 #私网路由传到隧道
R8:
[R8]int Tunnel 0/0/0
[R8-Tunnel0/0/0]ip add 192.168.3.2 24
[R8-Tunnel0/0/0]tunnel-protocol gre
[R8-Tunnel0/0/0]source 8.8.8.8
[R8-Tunnel0/0/0]destination 1.1.1.1
[R8]ip route-static 192.168.1.0 24 192.168.3.1
R1----ping-----R8