一 拓扑说明
R1、R2、R3通过ospf建立邻居,R1和R3通过非直连物理接口建立EBGP邻居
注意:默认情况下,BGP认为EBGP邻居是直连可达的。如果EBGP邻居间不是直连可达,则必须在BGP视图下配置允许同非直接相连网络上的邻居建立EBGP连接。
二 R1和R2设备配置
1.R1配置
bgp 100
peer 2.2.2.2 as-number 300
peer 2.2.2.2 ebgp-max-hop 255
#
address-family ipv4 unicast
network 192.168.1.1 255.255.255.255
peer 2.2.2.2 enable
2.R3配置
#
bgp 300
peer 1.1.1.1 as-number 100
peer 1.1.1.1 ebgp-max-hop 255
#
address-family ipv4 unicast
network 192.168.11.1 255.255.255.255
peer 1.1.1.1 enable
#
三 前后对比
3.1 R1、R3配置非直连ebgp邻居多条功能前-邻居无法建立-路由无法学习
<R1>dis bgp peer ipv4//邻居无法建立
BGP local router ID: 192.168.1.1
Local AS number: 100
Total number of peers: 1 Peers in established state: 0
* - Dynamically created peer
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
2.2.2.2 300 0 0 0 0 00:01:41 Connect
<R1>
<R1>
<R1>dis ip routing-table//没有bgp路由
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.0/30 Direct 0 0 1.1.1.1 GE0/0
1.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.3/32 Direct 0 0 1.1.1.1 GE0/0
2.2.2.0/30 O_INTRA 10 2 1.1.1.2 GE0/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
<R1>
<R1>
<R1>dis bgp routing-table ipv4
Total number of routes: 1
BGP local router ID is 192.168.1.1
Status codes: * - valid, > - best, d - dampened, h - history,
s - suppressed, S - stale, i - internal, e - external
Origin: i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
* > 192.168.1.1/32 127.0.0.1 0 32768 i
<R1>
3.2 R1、R3配置非直连ebgp邻居多条功能后-邻居正常建立-路由可以学习
<R1>dis bgp peer ipv4
BGP local router ID: 192.168.1.1
Local AS number: 100
Total number of peers: 1 Peers in established state: 1
* - Dynamically created peer
Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State
2.2.2.2 300 5 4 0 1 00:00:39 Established
<R1>
<R1>
<R1>dis ip routing-table
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.0/30 Direct 0 0 1.1.1.1 GE0/0
1.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
1.1.1.3/32 Direct 0 0 1.1.1.1 GE0/0
2.2.2.0/30 O_INTRA 10 2 1.1.1.2 GE0/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.11.1/32 BGP 255 0 2.2.2.2 GE0/0
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
<R1>
<R1>dis bgp routing-table ipv4
Total number of routes: 2
BGP local router ID is 192.168.1.1
Status codes: * - valid, > - best, d - dampened, h - history,
s - suppressed, S - stale, i - internal, e - external
Origin: i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
* > 192.168.1.1/32 127.0.0.1 0 32768 i
* >e 192.168.11.1/32 2.2.2.2 0 0 300i
<R1>