BGP第二次实验
一、题目要求。

二、根据要求配置合适的ip地址。(具体过程省略)
配置代码为:
IP ad *.*.*.* *
网段有:172.16.0~7.0 24 。
骨干的ip由 172.16.0.0 24 划分为 172.16.0.0 30,其他为R2~R7的环回网段。
三、在AS2中启用ospf宣告
以R3为例其他AS2中的路由进行同样的操作,因为AS2中的ip都由172.16.0.0划分而来所以直接宣告172.16.0.0。
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
随机检查两个路由器的邻居情况。

四、配置BGP。
AS1:
[r1]bgp 1
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.1.1.2 as-number 2
AS2:
因为题目要求需要有64512和64513所以需要用到
confederation peer-as 64513/64512
进行处理。
首先先说明自己的大号2,然后声明其他小号
不同小号之间需要用命令ebgp-max-hop进行处理。
以R4为例,其他路由做类似处理:
[r4]bgp 64512
[r4-bgp]router-id 4.4.4.4
[r4-bgp]confederation id 2
[r4-bgp]confederation peer-as 64513
[r4-bgp]peer 172.16.3.1 as-number 64512
[r4-bgp]peer 172.16.3.1 connect-interface LoopBack 0
[r4-bgp]peer 172.16.7.1 as-number 64513
[r4-bgp]peer 172.16.7.1 connect-interface LoopBack 0
[r4-bgp]peer 172.16.7.1 ebgp-max-hop 2
随机检查两个路由的BGP


AS3:
[r8]bgp 3
[r8-bgp]router-id 8.8.8.8
[r8-bgp]peer 78.1.1.1 as-number 2
进行对AS1、3的10.1.1.0、10.1.2.0环回的宣告。
[r1-bgp]network 10.1.1.0 24
[r8-bgp]network 10.1.2.0 24
五、最后调试,检测。
宣告后发现R3、5、上的10.1.1.0路由不优,4,6上的10.1.2.0路由不优所以需要修改下一跳。
[r7-bgp]peer 172.16.4.1 next-hop-local
[r7-bgp]peer 172.16.6.1 next-hop-local
R2与R7操作相同。
但是R4并没有拿到10.1.1.0的路由,因为BGP的水平分割所以需要将R2或者R4设置为客户端
以将R2作为客户端为例:
[r3-bgp]peer 172.16.2.1 reflect-client
其他没拿到路由的也做相应的处理。
然后处理黑洞问题,处理方式如下:
以R7为例:
[r7]ip route-static 172.16.0.0 21 NULL 0
[r7]bgp 64513
[r7-bgp]network 172.16.0.0 21
R2与R7做相同处理。
随机查寻两个路由器:


进行测试
<r1>ping -a 10.1.1.1 10.1.2.1
PING 10.1.2.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.2.1: bytes=56 Sequence=1 ttl=251 time=80 ms
Reply from 10.1.2.1: bytes=56 Sequence=2 ttl=251 time=50 ms
Reply from 10.1.2.1: bytes=56 Sequence=3 ttl=251 time=50 ms
Reply from 10.1.2.1: bytes=56 Sequence=4 ttl=251 time=50 ms
Reply from 10.1.2.1: bytes=56 Sequence=5 ttl=251 time=50 ms
最后解决192.168.1.0 到 192.168.2.0
因为10.1.1.1与10.1.2.1已经通了所以可以做GRE
用下一跳的方式导通操作如下:
[r1]int Tunnel0/0/0
[r1-Tunnel0/0/0]ip ad 10.1.3.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre
[r1-Tunnel0/0/0]source 10.1.1.1
[r1-Tunnel0/0/0]destination 10.1.2.1
[r1]ip route-static 192.168.2.0 24 10.1.3.2
[r8]int t0/0/0
[r8-Tunnel0/0/0]ip ad 10.1.3.2 24
[r8-Tunnel0/0/0]tunnel-protocol gre
[r8-Tunnel0/0/0]source 10.1.2.1
[r8-Tunnel0/0/0]destination 10.1.1.1
[r8]ip route-static 192.168.1.0 24 10.1.3.1
测试:
[r1]ping -a 192.168.1.1 192.168.2.1
PING 192.168.2.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.2.1: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 192.168.2.1: bytes=56 Sequence=2 ttl=255 time=40 ms
Reply from 192.168.2.1: bytes=56 Sequence=3 ttl=255 time=40 ms
Reply from 192.168.2.1: bytes=56 Sequence=4 ttl=255 time=40 ms
Reply from 192.168.2.1: bytes=56 Sequence=5 ttl=255 time=40 ms
至此实验结束。

276

被折叠的 条评论
为什么被折叠?



