ebgp邻居非直连无法建立邻居解决方法(2)

ebgp邻居非直连无法建立邻居解决方法(2)

一 拓扑说明

R1、R2、R3通过ospf建立邻居,R1和R3通过非直连物理接口建立EBGP邻居

注意:默认情况下,BGP认为EBGP邻居是直连可达的。如果EBGP邻居间不是直连可达,则必须在BGP视图下配置允许同非直接相连网络上的邻居建立EBGP连接。

二 R1和R3设备配置

1.R1配置

router bgp 100

bgp log-neighbor-changes

bgp graceful-restart restart-time 120

bgp graceful-restart stalepath-time 360

bgp graceful-restart

neighbor 2.2.2.2 remote-as 200

neighbor 2.2.2.2 ebgp-multihop 255

address-family ipv4

neighbor 2.2.2.2 activate

exit-address-family

!

2.R3配置

router bgp 200

bgp log-neighbor-changes

bgp graceful-restart restart-time 120

bgp graceful-restart stalepath-time 360

bgp graceful-restart

neighbor 1.1.1.1 remote-as 100

neighbor 1.1.1.1 ebgp-multihop 255

address-family ipv4

neighbor 1.1.1.1 activate

exit-address-family

!

三 前后对比

3.1 R1、R3配置非直连ebgp邻居多条功能前-邻居无法建立-路由无法学习

R1#sh bgp all su//邻居状态不对

For address family: IPv4 Unicast

BGP router identifier 192.168.1.1, local AS number 100

BGP table version is 1

0 BGP AS-PATH entries

0 BGP Community entries

0 BGP Prefix entries (Maximum-prefix:4294967295)

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd

2.2.2.2 4 200 0 0 0 0 0 never Idle

Total number of neighbors 1, established neighbors 0

R1#

R1#

R1#sh ip ro//没有路由

Codes: C - Connected, L - Local, S - Static

R - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow route

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2

SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

IA - Inter area, EV - BGP EVPN, A - Arp to host

LA - Local aggregate route

* - candidate default

Gateway of last resort is no set

C 1.1.1.0/30 is directly connected, GigabitEthernet 0/0

C 1.1.1.1/32 is local host.

O 2.2.2.0/30 [110/2] via 1.1.1.2, 00:04:44, GigabitEthernet 0/0

C 192.168.1.1/32 is local host.

R1#

R1#sh bgp ipv4 unicast

R1#

3.2 R1、R3配置非直连ebgp邻居多条功能后-邻居正常建立-路由可以学习

R1#sh bgp all su//邻居正常

For address family: IPv4 Unicast

BGP router identifier 192.168.1.1, local AS number 100

BGP table version is 3

2 BGP AS-PATH entries

0 BGP Community entries

2 BGP Prefix entries (Maximum-prefix:4294967295)

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd

2.2.2.2 4 200 7 5 3 0 0 00:03:191

Total number of neighbors 1, established neighbors 1

R1#

R1#sh ip ro//路由学习正常

Codes: C - Connected, L - Local, S - Static

R - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow route

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2

SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

IA - Inter area, EV - BGP EVPN, A - Arp to host

LA - Local aggregate route

* - candidate default

Gateway of last resort is no set

C 1.1.1.0/30 is directly connected, GigabitEthernet 0/0

C 1.1.1.1/32 is local host.

O 2.2.2.0/30 [110/2] via 1.1.1.2, 00:11:56, GigabitEthernet 0/0

C 192.168.1.1/32 is local host.

B 192.168.11.1/32 [20/0] via 2.2.2.2, 00:00:15

R1#

R1#sh bgp ipv4 unicast//路由学习正常

BGP table version is 3, local router ID is 192.168.1.1

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

S Stale, b - backup entry, m - multipath, f Filter, a additional-path

Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path

*> 192.168.1.1/32 0.0.0.0 0 32768 i

*> 192.168.11.1/32 2.2.2.2 0 0 200 i

Total number of prefixes 2

R1#