您的位置:首页 > 其它

CCNP精粹系列之三十二--BGP下一跳问题,推荐

2009-04-23 15:27 459 查看
Bgp[/b]的下一跳[/b]


[/b]
[/b]
R1:[/b]
R1(config)#int lo0[/b]
R1(config-if)#ip addr 192.168.10.1 255.255.255.0[/b]
R1(config-if)#no shut[/b]
R1(config-if)#exit[/b]
R1(config)#router bgp 64500[/b][/b]
fig-router)#neighbor 202.110.100.2 remote-as 64500[/b][/b]
R1(config-router)#net 202.110.100.0[/b]
R1(config-router)#net 192.168.10.0[/b]
R1(config-router)#exit[/b]
[/b]
R2[/b]上:[/b][/b]
Router(config)#host R2[/b]
R2(config)#int s1/0[/b]
R2(config-if)#ip addr 202.110.100.2 255.255.255.0[/b]
R2(config-if)#encap hdlc[/b]
R2(config-if)#no shut[/b]
R2(config-if)#exit[/b]
[/b]
R2(config)#int s1/1[/b]
R2(config-if)#ip addr 202.110.101.1 255.255.255.0[/b]
R2(config-if)#encap hdlc[/b]
R2(config-if)#clock rate 56000[/b]
R2(config-if)#no shut[/b]
R2(config-if)#exit[/b]
R2(config)#router bgp 64500[/b][/b]
R2(config-router)#neighbor 202.110.100.1 remote-as 64500[/b][/b]
R2(config-router)#neighbor 202.110.101.2 remote-as 64501[/b][/b]
R2(config-router)#net 202.110.100.0[/b]
R2(config-router)#net 202.110.101.0[/b]
[/b]
R3[/b]上:[/b][/b]
[/b]
R3(config-if)#int fa0/0[/b]
R3(config-if)#ip addr 192.168.20.1 255.255.255.0[/b]
R3(config-if)#no shut[/b]
R3(config)#int s1/1[/b]
R3(config-if)#ip addr 202.110.101.2 255.255.255.0[/b]
[/b]
R3(config-if)#encap hdlc[/b]
R3(config-if)#no shut[/b]
R3(config-if)#exit[/b]
[/b]
R3(config)#router bgp 64501[/b]
R3(config-router)#neighbor 202.110.101.1 remote-as 64500[/b][/b]
R3(config-router)#net 202.110.101.0[/b]
R3(config-router)#net 192.168.20.0[/b]
[/b]
在[/b]R1[/b]上测试:[/b][/b]
[/b]
R1#show ip bgp[/b]
BGP table version is 7, local router ID is 202.110.100.1[/b]
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,[/b]
r RIB-failure, S Stale[/b]
Origin codes: i - IGP, e - EGP, ? - incomplete[/b]
[/b]
Network Next Hop Metric LocPrf Weight [/b]Path[/b]
*> 192.168.10.0 0.0.0.0 0 32768 i[/b]
*>i192.168.20.0 202.110.101.2[/b] [/b] 0 100 0 64501 i[/b]
* i202.110.100.0 202.110.100.2 0 100 0 i[/b]
*> 0.0.0.0 0 32768 i[/b]
*>i202.110.101.0 202.110.100.2 0 100 0 i[/b]
R1#[/b]
我们在[/b]R1[/b]上查看[/b]fa0/0[/b]的路由下一跳不是常规下我们设想的[/b]100.2[/b],而是[/b]101.2 [/b],[/b][/b]
总结:路由器[/b]ebgp[/b]邻居处收到路由后,再把该路由转发给自己的[/b]IBGP[/b]邻居时,保留了路由的下一跳。[/b][/b]
解决办法:[/b][/b]
通告路由器转发“[/b]EBGP[/b]邻居的路由”给[/b]IBGP[/b]邻居时,修改路由的下一跳为自己的端口的下一跳[/b]ip[/b]。[/b][/b]
语法格式:[/b][/b]
([/b]config-router[/b])[/b]#neighbor [/b]邻居[/b]ip next-hop-self [/b]
注意[/b];[/b]这里邻居[/b]IP[/b]是指[/b]IBGP[/b](内部路由器)。本试验中的[/b]R1,[/b]如果将这个[/b]ip[/b]写成[/b]EBGP[/b],本试验的[/b]202.110.101.2[/b],那么试验结果是错误的,至于错误结果就不做了,所以朋友们一定要注意。[/b][/b]
所以在[/b]R2[/b]上做如下修改:[/b][/b]
[/b]
R2(config)#router bgp 64500[/b]
R2(config-router)#neighbor 202.110.101.2 remote-as 64501[/b]
R2(config-router)#neighbor 202.110.100.1 next-hop-self[/b][/b]
R2(config-router)#exit[/b]
再次在[/b]R1[/b]上看效果:[/b][/b]
[/b]
R1#show ip bgp[/b]
BGP table version is 9, local router ID is 202.110.100.1[/b]
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,[/b]
r RIB-failure, S Stale[/b]
Origin codes: i - IGP, e - EGP, ? - incomplete[/b]
[/b]
Network Next Hop Metric LocPrf Weight Path[/b]
*> 192.168.10.0 0.0.0.0 0 32768 i[/b]
*>i192.168.20.0 202.110.100.2[/b] [/b] 0 100 0 64501 i[/b]
* i202.110.100.0 202.110.100.2 0 100 0 i[/b]
*> 0.0.0.0 0 32768 i[/b]
*>i202.110.101.0 202.110.100.2 0 100 0 i[/b]
[/b]
[/b]
显然可以看出[/b]R1[/b]学习到的[/b]R3[/b]路由[/b]192.168.20.0[/b]的下一跳变为[/b]202.110.100.2 [/b],所以我们的修改下一跳成功。一切和理论符合。[/b][/b]
[/b]
BGP的med属性:[/b]
目睹实战现场:[/b]


[/b]
[/b]


[/b]
[/b]


[/b]
[/b]


[/b]
[/b]


[/b]
[/b]
[/b]


[/b]
[/b]
[/b]


[/b]
[/b]


[/b]
[/b]
[/b]


[/b]
[/b]
[/b]
[/b]
[/b]
[/b]
[/b]
[/b]
[/b]
[/b]
[/b]
[/b]
[/b]
[/b]
[/b]
[/b] 本文出自 “申雷岗 鸿鹄驰骋 欢迎您” 博客,请务必保留此出处http://shenleigang.blog.51cto.com/639523/152633
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: