BGP-20190320-next-hop-self

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了BGP-20190320-next-hop-self相关的知识,希望对你有一定的参考价值。

技术图片

(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的主要内容,如果未能解决你的问题,请参考以下文章