取消
显示结果 
搜索替代 
您的意思是: 
cancel
2199
查看次数
20
有帮助
2
评论
碧云天
Spotlight
Spotlight
本帖最后由 碧云天 于 2020-3-8 09:38 编辑
一.测试拓扑
093809ggagko3779hohk96.png
测试总结:
1.在MA环境下,EBGP的路由下一跳会自动优
--上图中R3将从IBGP邻居学习到的路由传给EBGP邻居R4时,会自动优化下一跳地址为R1的MA网段地址
2.上图中R3指定IBGP邻居R4时,不用指定路由下一跳地址为自己,这样,R3把通过EBGP学习到的路由发送给R1时,就不会修改下一跳地址。
二.基本配置
1.R2路由器

hostname R2
interface Loopback0
ip address 2.2.2.2 255.255.255.0
interface Loopback172
ip address 172.16.2.2 255.255.255.0
interface FastEthernet1/0
ip address 12.1.1.2 255.255.255.0
no shutdown
2.R1路由器
hostname R1
interface Loopback0
ip address 1.1.1.1 255.255.255.0
interface Loopback172
ip address 172.16.1.1 255.255.255.0
interface FastEthernet0/0
ip address 134.1.1.1 255.255.255.0
no shutdown
interface FastEthernet1/0
ip address 12.1.1.1 255.255.255.0
no shutdown
router rip
version 2
network 1.0.0.0
network 134.1.0.0
no auto-summary
3.R3路由器
hostname R3
interface Loopback0
ip address 3.3.3.3 255.255.255.0
interface Loopback172
ip address 172.16.3.3 255.255.255.0
interface FastEthernet0/0
ip address 134.1.1.3 255.255.255.0
no shutdown
router rip
version 2
network 3.0.0.0
network 134.1.0.0
no auto-summary
4.R4路由器
hostname R4
interface Loopback0
ip address 4.4.4.4 255.255.255.0
interface Loopback172
ip address 172.16.4.4 255.255.255.0
interface FastEthernet0/0
ip address 134.1.1.4 255.255.255.0
no shutdown
三.BGP配置
1.R2路由器

hostname R2
router bgp 65002
bgp router-id 2.2.2.2
network 172.16.2.0 mask 255.255.255.0
neighbor 12.1.1.1 remote-as 65001
2.R1路由器
router bgp 65001
bgp router-id 1.1.1.1
neighbor 3.3.3.3 remote-as 65001
neighbor 3.3.3.3 update-source Loopback0
neighbor 12.1.1.2 remote-as 65002
3.R3路由器
router bgp 65001
bgp router-id 3.3.3.3
neighbor 1.1.1.1 remote-as 65001
neighbor 1.1.1.1 update-source Loopback0
neighbor 134.1.1.4 remote-as 65004
4.R4路由器
router bgp 65004
bgp router-id 4.4.4.4
neighbor 134.1.1.3 remote-as 65001
四.下一跳地址验证
1.R2宣告本地路由到bgp进程,本地显示的下一跳地址为0.0.0.0
R2#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 172.16.2.0/24 0.0.0.0 0 32768 i
R2#
2.R1通过EBGP学习到的BGP路由,下一跳地址为对等体的更新源地址
R1#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 172.16.2.0/24 12.1.1.2 0 0 65002 i
R1#
3.R3通过IBGP学习到的BGP路由,默认下一跳地址不会被修改
R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
* i 172.16.2.0/24 12.1.1.2 0 100 0 65002 i
R3#
备注:没有>,因为R3没有到12.1.1.2的路由,这时R4无法通过R3学习到该路由。
4.R1修改对R3的BGP邻居的下一跳地址为自己
R1(config)#router bgp 65001
R1(config-router)# neighbor 3.3.3.3 next-hop-self
5.此时R3通过IBGP学习到的BGP路由,下一跳地址已经修改
R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*>i 172.16.2.0/24 1.1.1.1 0 100 0 65002 i
R3#
备注:这次有>,因为R3通过RIP学习到1.1.1.1的路由
6.R4通过EBGP邻居R3学习到的BGP路由下一跳地址并不是R3的接口地址
R4#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 172.16.2.0/24 134.1.1.1 0 65001 65002 i
R4#
备注:因为R3检测到到1.1.1.1是通过134.1.1.1,而134.1.1.4与它相同网段,所以告知R4下一跳地址为134.1.1.1,从debug日志可以看得出来。
R3#show ip route rip | in FastEthernet
R 1.1.1.0 [120/1] via 134.1.1.1, 00:00:15, FastEthernet0/0
R3#
R3#debug ip bgp updates
BGP updates debugging is on for address family: IPv4 Unicast
R3#clear ip bgp * soft
R3#
*Mar 6 13:11:40.051: BGP(0): 134.1.1.4 NEXT_HOP is set to 134.1.1.1 by first hop lookup for net 172.16.2.0/24
*Mar 6 13:11:40.051: BGP(0): (base) 134.1.1.4 send UPDATE (format) 172.16.2.0/24, next 134.1.1.1, metric 0, path 65002
7.R4宣告本地路由到BGP进程
R4(config)#router bgp 65004
R4(config-router)#network 172.16.4.0 mask 255.255.255.0
8.R3通过EBGP邻居学习到该条路由下一跳地址为R4的接口地址
R3#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*>i 172.16.2.0/24 1.1.1.1 0 100 0 65002 i
*> 172.16.4.0/24 134.1.1.4 0 0 65004 i
R3#
9.R1学习到的该路由下一跳地址仍然为R4的地址
R1#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 172.16.2.0/24 12.1.1.2 0 0 65002 i
*>i 172.16.4.0/24 134.1.1.4 0 100 0 65004 i
R1#
备注:因为R3指定R1的邻居的时候,没有设定下一跳地址为自己。
9.R2通过EBGP邻居学习到下一跳地址已经被修改
R2#show ip bgp | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 172.16.2.0/24 0.0.0.0 0 32768 i
*> 172.16.4.0/24 12.1.1.1 0 65001 65004 i
R2#
评论
l8310892118l
Level 1
Level 1

谢谢版主分享!
likuo
Spotlight
Spotlight
拓扑图很直观。
入门指南

使用上面的搜索栏输入关键字、短语或问题,搜索问题的答案。

我们希望您在这里的旅程尽可能顺利,因此这里有一些链接可以帮助您快速熟悉思科社区:









快捷链接