简介
本文描述两个分支路由器通过ISP连接并在它们之间运行BGP的情况。
先决条件
要求
Cisco 建议您了解以下主题:
- Internet 服务提供商 (ISP)
- 边界网关协议 (BGP)
使用的组件
本文档不限于特定的软件和硬件版本。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
规则
要将提供商边缘(PE)路由器配置为允许重新通告包含重复自治系统编号(ASN)的所有前缀,请在路由器配置模式下使用邻居alloas-incommand。要禁用PE路由器的ASN重新启用,请使用此命令的enoform。
neighbor ip-address alloas-in [number]
no neighbor allowas-in [number]
| IP地址 | 相邻路由器的IP地址。 | 
| 号码 | (可选)指定允许PE路由器的ASN通告的次数。范围为1至10。如果未提供数字,则使用默认值3次。 | 
在集中星型配置中,PE路由器重新通告包含重复自治系统编号的所有前缀。使用neighbor allowas-incommand在每个PE路由器上配置两个VRF,以便接收和重新通告前缀,如下所示:
您可以通过指定介于1和10之间的数字来控制通告ASN的次数。
示例
此示例显示如何使用ASN 100配置PE路由器,以允许来自VRF地址系列虚拟专用网络(VPN)IPv4 vrf1的前缀。IP地址为192.168.255.255的相邻PE路由器被设置为使用同一ASN重新通告给其他PE路由器6次。
Router(config)#router bgp 100
Router(config-router)#address-family ipv4 vrf vrf1
Router(config-router)#neighbor 192.168.255.255 allowas-in 6
背景信息
本文档介绍两个分支路由器通过Internet服务器提供商(ISP)连接并在它们之间运行边界网关协议(BGP)的场景。两个分支路由器(R1和R2)虽然位于不同的位置,但共享相同的AS编号。路由从分支机构(本例中为R1)到达服务提供商(SP)网络后,可以使用用户AS进行标记。默认情况下,当SP将其传递到另一个分支路由器(R2)时,如果另一个分支也运行带有SP的BGP并使用相同的AS编号,则路由可能会被丢弃。在此场景中,发出neighbor allowas-in命令以允许另一端的BGP注入更新。本文档提供了一个示例配置,可帮助您了解BGP中的Alloas-in功能。
 
注意:此功能仅可用于真 eBGP 对等体。您无法对作为不同联盟子 AS 成员的两个对等体使用此功能。
 
配置
本部分为您提供了配置本文档所述功能的信息。
 
注意:使用命令查找工具查找有关本文档中使用的命令的详细信息。
 
 
注意:只有注册的思科用户才能访问内部思科工具和信息。
 
网络图
本文档使用以下网络设置:
 网络图
网络图
配置
本文档使用以下配置:
| Router_A上的配置 | 
| interface Loopback1
 ip address 10.1.1.1 255.255.255.255
!
interface Loopback2
 ip address 10.2.2.2 255.255.255.255
!
interface Loopback3
 ip address 10.3.3.3 255.255.255.255
!
interface GigabitEthernet0/1
 no switchport
 ip address 192.168.12.2 255.255.255.0
!
router eigrp 100
 network 10.1.1.1 0.0.0.0
 network 10.2.2.2 0.0.0.0
 network 10.3.3.3 0.0.0.0
 network 192.168.12.0
 auto-summary
!
 | 
| 路由器R1上的配置 | 
| interface Loopback22
 ip address 10.22.22.22 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.12.1 255.255.255.0
 duplex auto
 speed auto
!
interface Serial1/0
 ip address 172.16.12.1 255.255.255.0
!
!
router eigrp 100
 network 192.168.12.0
 no auto-summary
!
router bgp 121
 no synchronization
 bgp router-id 10.22.22.22
 bgp log-neighbor-changes
 network 10.22.22.22 mask 255.255.255.255 
!--- This is the advertising loopback address.
 redistribute eigrp 100 
!--- This shows the redistributing internal routes in BGP.
 neighbor 172.16.12.2 remote-as 500 
!--- This shows the EBGP connection with ISP.
 neighbor 172.16.12.2 ebgp-multihop 5
 no auto-summary
!
 | 
此示例显示EIGRP在Router_A和R1之间运行:
r1#show ip eigrp neighbors
IP-EIGRP neighbors for process 100
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
0   192.168.12.2              Fa0/0             14 01:17:12  828  4968  0  7
本示例显示路由器R1如何通过EIGRP从Router_A获取路由:
r1#show ip route eigrp 100
D    10.0.0.1/8 [90/156160] via 192.168.12.2, 00:02:24, FastEthernet0/0
D    10.0.0.2/8 [90/156160] via 192.168.12.2, 00:02:24, FastEthernet0/0
D    10.0.0.3/8 [90/156160] via 192.168.12.2, 00:02:24, FastEthernet0/0
此示例显示路由器R1如何与运行BGP AS500的ISP建立BGP连接:
r1#show ip bgp summary
BGP router identifier 10.22.22.22, local AS number 121
BGP table version is 19, main routing table version 19
7 network entries using 924 bytes of memory
7 path entries using 364 bytes of memory
5/4 BGP path/bestpath attribute entries using 840 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
Bitfield cache entries: current 1 (at peak 2) using 32 bytes of memory
BGP using 2184 total bytes of memory
BGP activity 40/33 prefixes, 42/35 paths, scan interval 60 secs
Neighbor        V          AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.16.12.2     4        500      86      76       19    0    0 00:25:13        2
此示例显示R1如何通告BGP获知的路由:
r1#show ip bgp
BGP table version is 19, local router ID is 10.22.22.22
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
*> 10.0.0.1          192.168.12.2          156160         32768 ? 
*> 10.0.0.2          192.168.12.2          156160         32768 ?
*> 10.0.0.3          192.168.12.2          156160         32768 ?
*> 10.10.12.0/24     172.16.12.2              0             0 500 i
*> 10.22.22.22/32    0.0.0.0                  0         32768 i
r> 172.16.12.0/24    172.16.12.2              0             0 500 i
*> 192.168.12.0      0.0.0.0                  0         32768 ?
r1#ping 10.10.12.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.12.2, timeout is 2 seconds:
!!!!!  
!--- This is the connectivity with Router 2 across the Internet cloud.
| 路由器R2上的配置 | 
| interface Loopback33
 ip address 10.33.33.33 255.255.255.255
!
interface Serial1/0
 ip address 10.10.12.1 255.255.255.0
!
router bgp 121
 no synchronization
 bgp router-id 10.33.33.33
 bgp log-neighbor-changes
 network 10.33.33.33 mask 255.255.255.255 
!--- This is the advertising loopback address.
 
 neighbor 10.10.12.2 remote-as 500 
!--- This is the EBGP connection with ISP.
 neighbor 10.10.12.2 ebgp-multihop 5
 no auto-summary!
 | 
路由器R2不会从路由器R1获知任何路由。
这是自然的行为,因为BGP会尝试避免路由环路。例如,默认情况下会禁用重新通告包含重复自治系统编号(ASN)的所有前缀。
R2不会收到来自R1的已重分布的EIGRP路由(10.0.0.1、10.0.0.2、10.0.0.3)和BGP内部路由10.22.22.22,因为这些路由来自互联网上的同一ASN。因为R2在AS-PATH中看到自己的AS编号(121),所以R2不会采用这些路由。
r2#show ip bgp
BGP table version is 20, local router ID is 10.33.33.33
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
r> 10.10.12.0/24    10.10.12.2               0             0 500 i
*> 10.33.33.33/32   0.0.0.0                  0         32768 i
*> 172.16.12.0/24   10.10.12.2               0             0 500 i
要允许重新通告包含重复ASN的所有前缀,请在路由器R2的路由器配置模式下使用neighbor allois-in命令。
r2(config-router)#neighbor 10.10.12.2 allowas-in
r2#clear ip bgp *
r2#show ip bgp
BGP table version is 10, local router ID is 10.33.33.33
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
*> 10.0.0.1          10.10.12.2                             0 500 121 ?
*> 10.0.0.2          10.10.12.2                             0 500 121 ?
*> 10.0.0.3          10.10.12.2                             0 500 121 ?
r> 10.10.12.0/24     10.10.12.2               0             0 500 i
*> 10.22.22.22/32    10.10.12.2                             0 500 121 i
*  10.33.33.33/32    10.10.12.2                             0 500 121 i
*>                   0.0.0.0                  0         32768 i
*> 172.16.12.0/24    10.10.12.2               0             0 500 i
*> 192.168.12.0      10.10.12.2                             0 500 121 ?
现在尝试从R1 ping R2:
r2#ping 10.22.22.22
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.22.22.22, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 56/57/60 ms
验证
当前没有可用于此配置的验证过程。
故障排除
错误消息
“%BGP%邻居A.B.C.D接收伪路由:收到AS loop错误消息。
此通知意味着CE路由器收到的BGP路由在AS路径中具有自己的AS编号,并且被视为CE路由器的路由器环路。解决方法是,使用分配功能配置CE路由器,如上例所示。
相关信息