码迷,mamicode.com
首页 > 其他好文 > 详细

BGP-20190320-next-hop-self

时间:2019-03-20 23:31:02      阅读:260      评论:0      收藏:0      [点我收藏+]

标签:hang   ethernet   images   back   基本配置   route   shadow   origin   text   

技术图片

(1)本实验主要论述了 BGP协议中、next-hop-self 的根本原因、如上图 R3学习到R1 的1.1.1.1/32路由的下一跳是R1 的接口f0/0 的IP地址 12.1.1.1、为什么?

R3#sh ip bgp 
BGP table version is 4, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
* i1.1.1.1/32       12.1.1.1                 0    100      0 1 i
r>i2.2.2.2/32       23.1.1.2                 0    100      0 i
*> 3.3.3.3/32       0.0.0.0                  0         32768 i
R3#

(2)基本配置如下
R1配置:

interface Loopback1
 ip address 1.1.1.1 255.255.255.255
interface FastEthernet0/0
 ip address 12.1.1.1 255.255.255.0
 duplex auto
 speed auto

router bgp 1
 no synchronization
 bgp log-neighbor-changes
 network 1.1.1.1 mask 255.255.255.255
 neighbor 12.1.1.2 remote-as 234
 no auto-summary

R2配置:

interface Loopback2
 ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 12.1.1.2 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 23.1.1.2 255.255.255.0
 duplex auto
 speed auto
!
router ospf 1
 log-adjacency-changes
 network 2.2.2.2 0.0.0.0 area 0
 network 23.1.1.2 0.0.0.0 area 0
!
router bgp 234
 no synchronization
 bgp log-neighbor-changes
 network 2.2.2.2 mask 255.255.255.255
 neighbor 12.1.1.1 remote-as 1
 neighbor 23.1.1.3 remote-as 234
 no auto-summary
!

R3配置:

interface Loopback3
 ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 23.1.1.3 255.255.255.0
 duplex auto
 speed auto
!
router ospf 1
 log-adjacency-changes
 network 3.3.3.3 0.0.0.0 area 0
 network 23.1.1.3 0.0.0.0 area 0
!
router bgp 234
 no synchronization
 bgp log-neighbor-changes
 network 3.3.3.3 mask 255.255.255.255
 neighbor 23.1.1.2 remote-as 234
 no auto-summary
!

(3)配置next-hop-self之后效果:

R2(config)#router bgp 234
R2(config-router)#neighbor 23.1.1.3 next-hop-self 
R3#sh ip bgp 
BGP table version is 6, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i1.1.1.1/32       23.1.1.2                 0    100      0 1 i
r>i2.2.2.2/32       23.1.1.2                 0    100      0 i
*> 3.3.3.3/32       0.0.0.0                  0         32768 i
R3#

(4)原因分析:
记得我在讲解BGP概述时候曾经跟学生讲过、BGP这个EGP协议是工作在AS by AS之间的、BGP着眼的边界是AS、那么从这个角度来看我们应该把一个AS号内的设备逻辑当成是一台
大的路由器、
技术图片

R1 看成是一台大的路由器1 、R2和R3看成是一台大的路由器2 、2收到1的路由、下一跳默认自然指向1的接口IP地址 12.1.1.1/24

BGP-20190320-next-hop-self

标签:hang   ethernet   images   back   基本配置   route   shadow   origin   text   

原文地址:https://blog.51cto.com/jinchengzheng/2366278

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!