一 拓扑说明R1、R2、R3通过ospf建立邻居R1和R3通过非直连物理接口建立EBGP邻居注意默认情况下,BGP认为EBGP邻居是直连可达的。如果EBGP邻居间不是直连可达则必须在BGP视图下配置允许同非直接相连网络上的邻居建立EBGP连接。二 R1和R2设备配置1.R1配置bgp 100peer 2.2.2.2 as-number 300peer 2.2.2.2 ebgp-max-hop 255#address-family ipv4 unicastnetwork 192.168.1.1 255.255.255.255peer 2.2.2.2 enable2.R3配置#bgp 300peer 1.1.1.1 as-number 100peer 1.1.1.1 ebgp-max-hop 255#address-family ipv4 unicastnetwork 192.168.11.1 255.255.255.255peer 1.1.1.1 enable#三 前后对比3.1 R1、R3配置非直连ebgp邻居多条功能前-邻居无法建立-路由无法学习R1dis bgp peer ipv4//邻居无法建立BGP local router ID: 192.168.1.1Local AS number: 100Total number of peers: 1 Peers in established state: 0* - Dynamically created peerPeer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State2.2.2.2 300 0 0 0 0 00:01:41 ConnectR1R1R1dis ip routing-table//没有bgp路由Destinations : 12 Routes : 12Destination/Mask Proto Pre Cost NextHop Interface0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop01.1.1.0/30 Direct 0 0 1.1.1.1 GE0/01.1.1.1/32 Direct 0 0 127.0.0.1 InLoop01.1.1.3/32 Direct 0 0 1.1.1.1 GE0/02.2.2.0/30 O_INTRA 10 2 1.1.1.2 GE0/0127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0R1R1R1dis bgp routing-table ipv4Total number of routes: 1BGP local router ID is 192.168.1.1Status codes: * - valid, - best, d - dampened, h - history,s - suppressed, S - stale, i - internal, e - externalOrigin: i - IGP, e - EGP, ? - incompleteNetwork NextHop MED LocPrf PrefVal Path/Ogn* 192.168.1.1/32 127.0.0.1 0 32768 iR13.2 R1、R3配置非直连ebgp邻居多条功能后-邻居正常建立-路由可以学习R1dis bgp peer ipv4BGP local router ID: 192.168.1.1Local AS number: 100Total number of peers: 1 Peers in established state: 1* - Dynamically created peerPeer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State2.2.2.2 300 5 4 0 1 00:00:39 EstablishedR1R1R1dis ip routing-tableDestinations : 13 Routes : 13Destination/Mask Proto Pre Cost NextHop Interface0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop01.1.1.0/30 Direct 0 0 1.1.1.1 GE0/01.1.1.1/32 Direct 0 0 127.0.0.1 InLoop01.1.1.3/32 Direct 0 0 1.1.1.1 GE0/02.2.2.0/30 O_INTRA 10 2 1.1.1.2 GE0/0127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0192.168.11.1/32 BGP 255 0 2.2.2.2 GE0/0224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0R1R1dis bgp routing-table ipv4Total number of routes: 2BGP local router ID is 192.168.1.1Status codes: * - valid, - best, d - dampened, h - history,s - suppressed, S - stale, i - internal, e - externalOrigin: i - IGP, e - EGP, ? - incompleteNetwork 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 300iR1