思科BGP技术详解八
用BGP的十二种选路规则倒序的方法来验证属性。如图:
R1是AS100 R2-R4是AS 200,内部启OSPF100,每个路由器启loop。
基本配置完成,Ping 直连链路。
R1:# Router bgp 100
Router id 1.1.1.1
Neig 12.1.1.2 remote-as 200
Neig 13.1.1.2 remote-as 200
Network 1.1.1.0 mask 255.255.255.0
Exit
R2:# router bgp 200
bgp router-id 2.2.2.2
neighbor ccnp peer-group
neighbor ccnp remote-as 200
neighbor ccnp update-source Loopback0
neighbor ccnp next-hop-self
neighbor 3.3.3.3 peer-group ccnp
neighbor 4.4.4.4 peer-group ccnp
neighbor 12.1.1.1 remote-as 100
R3:# router bgp 200
bgp router-id 3.3.3.3
neighbor ccnp peer-group
neighbor ccnp remote-as 200
neighbor ccnp update-source Loopback0
neighbor 2.2.2.2 peer-group ccnp
neighbor 4.4.4.4 peer-group ccnp
neighbor 13.1.1.1 remote-as 100
R4:router bgp 200
bgp router-id 4.4.4.4
neighbor ccnp peer-group
neighbor ccnp remote-as 200
neighbor ccnp update-source Loopback0
neighbor ccnp next-hop-self
neighbor 2.2.2.2 peer-group ccnp
neighbor 3.3.3.3 peer-group ccnp
network 4.4.4.0 mask 255.255.255.0后来配置上的
R4:Show ip bgp 什么也没有显示:
原因:
R3上也要指邻居要指邻居R1:13.1.1.1,R2上也要指邻居R1:12.1.1.1,也就是不只是AS内部指邻居,AS与AS之间也要指邻居。
配置完成:R4:show ip bgp 显示:
Network Next Hop Metric LocPrf Weight Path
*>i1.1.1.0/24 2.2.2.2 0 100 0 100 i
R1#:show ip bgp 没有4.4.4.4网络,原因时,show runn发现在R4上没把loop口宣到BGP中,配置: R4:Router bgp 200 Net 4.4.4.0 mask 255.255.255.0
R1:show ip bgp 有了:
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 32768 i
* 4.4.4.0/24 13.1.1.2 0 200 i
*> 12.1.1.2 0 0 200 i
4.4.4.4 和其他学到了二条路由,“>”是在下面的一条(有>的是最优路径),是从来12.1.1.2走的。是什么原因从下面选的?
第十二条:对等体的最小IP。不符合。
第十一条:“选router ID 较小的”在这里不符合,因13.1.1.2的router-id 是3.3.3.3.
第九条:R1上用show ip bpg sum
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
12.1.1.2 4 200 36 41 9 0 0 00:27:28 1
13.1.1.2 4 200 35 37 9 0 0 00:27:25 1
12.1.12建立的时间是:28秒,而13.1.1.2建立的时间是:25秒,是按照第十条()选路规则时行选择路径的。为验证,可以去影响这个路径,可以去修改,可以让他们重新建立连接一下,重新建立邻居,clear一下即可。R1:clear ip bgp 12.1.1.2
R1:#show ip bpg
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 0.0.0.0 0 32768 i
* 4.4.4.0/24 12.1.1.2 0 200 i
*> 13.1.1.2 0 200 i
换过来了。>指向了13.1.1.2成了最优路径。
Show ip bgp sum
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
12.1.1.2 4 200 48 54 10 0 0 00:01:57 1
13.1.1.2 4 200 43 46 10 0 0 00:35:39 1
13.1.1.2建立时间为大于12.1.1.2的建立时间了,所选择了13.1.1.2路径。验证了第十条属性。
第八条:选择IGP最小的路径。
现在默认走的上面有即:show ip bgp
Network Next Hop Metric LocPrf Weight Path
* i1.1.1.0/24 13.1.1.1 0 100 0 100 i
*>i 2.2.2.2 0 100 0 100 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
那么现在要示它走下面的路径到R4(默认是走的2.2.2.2,度量是11)。要修改把R2的IGP路径改大,则会选择R3来走了。能不能实现试验呢?
R4:#Show ip route
34.0.0.0/24 is subnetted, 1 subnets
C 34.1.1.0 is directly connected, FastEthernet0/1
1.0.0.0/24 is subnetted, 1 subnets
B 1.1.1.0 [200/0] via 2.2.2.2, 00:04:36
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0 [110/11] via 24.1.1.1, 02:05:14, FastEthernet0/0
3.0.0.0/24 is subnetted, 1 subnets
O 3.3.3.0 [110/11] via 34.1.1.1, 02:05:14, FastEthernet0/1
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
24.0.0.0/24 is subnetted, 1 subnets
C 24.1.1.0 is directly connected, FastEthernet0/0
R4:# int f0/0 (指向R2的接口)
Ip ospf cost 40 (修改IGP度量)
cleare ip ospf P (清一下ospf 进程)
R4:show ip route 度量变为41.
34.0.0.0/24 is subnetted, 1 subnets
C 34.1.1.0 is directly connected, FastEthernet0/1
1.0.0.0/24 is subnetted, 1 subnets
B 1.1.1.0 [200/0] via 2.2.2.2, 00:13:04
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0 [110/41] via 24.1.1.1, 00:00:02, FastEthernet0/0 变成40了(还有原先的1)
3.0.0.0/24 is subnetted, 1 subnets
O 3.3.3.0 [110/11] via 34.1.1.1, 00:00:02, FastEthernet0/1
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
24.0.0.0/24 is subnetted, 1 subnets
C 24.1.1.0 is directly connected, FastEthernet0/0
R4#:show ip bgp
* i1.1.1.0/24 13.1.1.1 0 100 0 100 i
*>i 2.2.2.2 0 100 0 100 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
没有切换过来,1.1.1.1的上面一条的下一跳是13.1.1.1,应该是3.3.3.3 才对。
R3#:SHOW runn
在rouer bgp 200内,没有把3.3.3.3宣到BGP 中。
Router bgp 200
Net 3.3.3.0 mask 255.255.255.0
R4 show ip bgp
Network Next Hop Metric LocPrf Weight Path
* i1.1.1.0/24 13.1.1.1 0 100 0 100 i
*>i 2.2.2.2 0 100 0 100 i
r>i3.3.3.0/24 3.3.3.3 0 100 0 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
还是不正确,没有切换过来,只是多了一条3.3.3.3的写入路由表失败的路由。1.1.1.1的下一跳还是的3.1.1.1,把刚配置的命令删了。
R3:#show runn
发现:在R3上没有指自己为更新源。由此想到了。IBGP内部的水平分割问题“下一跳不变”的事来,肯定是指下一跳出问题了。配置上到R4上:show ip bgp ,有了,终于把2.2.2.2 切换到3.3.3.3了。验证了在IBGP内部的IGP度量小的路径优先了。同时前和第九条的试验内容没有改变,只是做了第八条试验,所以第八条优于第九条。
#show ip bgp
*>i1.1.1.0/24 3.3.3.3 0 100 0 100 i
* i 2.2.2.2 0 100 0 100 i
*> 4.4.4.0/24 0.0.0.0 0 32768 i
第七条:EBGP>IBGP: EBGP比IBGP优先本试验中没有。
暂时还木有人评论,坐等沙发!