本檔案介紹邊界閘道通訊協定(BGP)local-AS功能,該功能最初在Cisco IOS®軟體版本12.0(5)S中提供。
本檔案建議瞭解BGP路由通訊協定及其運作。有關詳細資訊,請參閱Examine Border Gateway Protocol案例研究。
本檔案中的資訊是使用以下軟體版本建立的,但並不限於特定軟體和硬體版本:
Cisco IOS 軟體版本 12.2(28)
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
BGP local-AS功能允許運行一個BGP自治系統(AS)的路由器向特定eBGP鄰居顯示不同的AS編號。這在AS遷移場景中很有用,例如一個ISP獲取另一個ISP,而客戶無法立即更改或偏好維護其eBGP配置。這樣可確保平穩過渡,並將所獲取的ISP客戶的中斷降至最低。
例如,請參閱網路圖,其中圖1中,ISP-A尚未購買ISP-B,圖2中,ISP-A已購買ISP-B,而ISP-B使用BGP local-AS功能。如果ISP-A購買ISP-B,但ISP-B客戶不想修改任何配置,則BGP local-AS功能允許ISP-B中的路由器成為ISP-A(100)AS的成員。同時,這些路由器對客戶而言似乎保留了其ISP-B(200)AS編號。
在圖2中,ISP-B現在屬於AS 100,ISP-C(客戶)屬於AS 300。與ISP-C對等時,ISP-B使用neighbor <ISP-C> local-as 200命令將AS 200用作其AS編號。在從ISP-B傳送到ISP-C的BGP更新中,AS_PATH屬性中的AS_SEQUENCE包含「200 100」。 由於為ISP-C配置了local-as 200命令,因此「200」以ISP-B開頭。
通常,組合的ISP-A/B會將ISP-B中的路由器重新編號為AS 100的一部分。如果ISP-C無法使用ISP-B更改其eBGP配置,該怎麼辦?在BGP本地AS功能之前,組合的ISP-A/B必須維護兩個AS編號。local-as命令允許ISP-A/B在物理上是一個自治系統,而對ISP-C來說它看起來是兩個AS。
此清單顯示本檔案中的組態所使用命令的語法:
neighbor
neighbor
附註:配置的本地AS不能與本地BGP進程AS相同。
附註:配置的本地AS不能與遠端對等AS相同。
附註:只有對等體是真正的eBGP對等體時,local-as命令才有效。它不適用於聯盟中不同子AS中的兩個對等體。
本節提供用於設定本檔案中所述功能的資訊。
本檔案會使用這些網路設定。
圖 1

圖 2

路由器(在ISP-B內)運行BGP AS 100,它代表ISP-B使用的捕獲後AS。local-as 200 命令會導致ISP-C將此鄰居視為AS 200而不是AS 100。它還導致AS 200優先於傳送到ISP-C的路由通告。
| ISP-B(AS 100,local-as 200) |
|---|
hostname ISP-B ! interface serial 0 ip address 192.168.1.1 255.255.255.252 ! interface ethernet 0 ip address 192.168.4.1 255.255.255.0 ! router bgp 100 !--- Note the AS number 100. This is the AS number of ISP-A, which is now |
| ISP-C(AS 300) |
|---|
hostname ISP-C ! interface serial 1 ip address 192.168.1.2 255.255.255.252 ! interface ethernet 0 ip address 192.168.9.1 255.255.255.0 ! router bgp 300 neighbor 192.168.1.1 remote-as 200 !--- Defines the eBGP connection to ISP-B. !--- Note AS is 200 and not AS 100. network 192.168.9.0 ! ! |
本節提供的資訊可用於確認您的組態是否正常運作。
在ISP-B上,show ip bgp summary確認本地BGP進程作為AS 100運行。
ISP-B#show ip bgp summary BGP router identifier 192.168.4.1, local AS number 100 BGP table version is 3, main routing table version 3 2 network entries and 2 paths using 266 bytes of memory 2 BGP path attribute entries using 104 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 BGP activity 2/6 prefixes, 2/0 paths, scan interval 15 secs Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 192.168.1.2 4 300 29 29 3 0 0 00:25:19 1
在ISP-C的下一個輸出中,show ip bgp summary確認ISP-B位於192.168.1.1的鄰居被視為AS 200。
ISP-C#show ip bgp summary BGP table version is 3, main routing table version 3 2 network entries (2/6 paths) using 480 bytes of memory 2 BGP path attribute entries using 192 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 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 192.168.1.1 4 200 34 34 3 0 0 00:30:19 1
在以下輸出中,請注意ISP-B在從ISP-C獲知的路由前置「200」。local-as 200命令導致ISP-B將AS 200呈現給ISP-C。ISP-C通過AS_PATH 200 100檢視從ISP-B獲知的路由,而ISP-B通過AS_PATH 200 300顯示從ISP-C獲知的路由。
ISP-B#show ip bgp
BGP table version is 3, local router ID is 192.168.4.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 192.168.4.0 0.0.0.0 0 32768 i *> 192.168.9.0 192.168.1.2 0 0 200 300 i
請注意,show ip bgp輸出會確認local-as命令引入的AS_PATH行為。ISP-C從ISP-B接收帶有AS_PATH "200 100"的路由192.168.4.0/24。
ISP-C#show ip bgp BGP table version is 3, local router ID is 192.168.1.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 192.168.4.0 192.168.1.1 0 0 200 100 i *> 192.168.9.0 0.0.0.0 0 32768 i
以下命令在其輸出中顯示配置的local-as值:
show ip bgp neighbor
show ip bgp peer-group
ISP-B#show ip bgp neighbors 192.168.1.2
BGP neighbor is 192.168.1.2, remote AS 300, local AS 200, external link
BGP version 4, remote router ID 192.168.9.1
BGP state = Established, up for 00:22:42
Last read 00:00:42, hold time is 180, keepalive interval is 60 seconds
Neighbor capabilities:
Route refresh: advertised and received(old & new)
Address family IPv4 Unicast: advertised and received
Message statistics:
InQ depth is 0
OutQ depth is 0
Sent Rcvd
Opens: 1 1
Notifications: 0 0
Updates: 2 1
Keepalives: 25 25
Route Refresh: 0 1
Total: 28 28
Default minimum time between advertisement runs is 30 seconds
debug ip bgp updates命令顯示從鄰居接收到的字首及其屬性。此輸出顯示,字首192.168.4.0/24與AS PATH 200、100一起接收。
注意:debug ip bgp updates命令可以在生產路由器上生成大量輸出。僅在受控故障排除期間使用,最好在維護時段或TAC指導下使用。收集所需的輸出後,使用undebug all或no debug ip bgp updates禁用調試。
ISP-C# *May 10 12:45:14.947: BGP(0): 192.168.1.1 computing updates, afi 0, neighbor version 0, table version 5, starting at 0.0.0.0 *May 10 12:45:14.947: BGP(0): 192.168.1.1 send UPDATE (format) 192.168.9.0/24, next 192.168.1.2, metric 0, path *May 10 12:45:14.947: BGP(0): 192.168.1.1 1 updates enqueued (average=52, maximum=52) *May 10 12:45:14.947: BGP(0): 192.168.1.1 update run completed, afi 0, ran for 0ms, neighbor version 0, start version 5, throttled to 5 *May 10 12:45:14.947: BGP: 192.168.1.1 initial update completed *May 10 12:45:15.259: BGP(0): 192.168.1.1 rcvd UPDATE w/ attr: nexthop 192.168.1.1, origin i, metric 0, path 200 100 *May 10 12:45:15.259: BGP(0): 192.168.1.1 rcvd 192.168.4.0/24 *May 10 12:45:15.279: BGP(0): Revise route installing 192.168.4.0/24 -> 192.168.1.1 to main IP table ISP-C#
| 修訂 | 發佈日期 | 意見 |
|---|---|---|
5.0 |
09-Jul-2026
|
重新認證 |
2.0 |
08-May-2023
|
已更新格式。重新認證。 |
1.0 |
10-Dec-2001
|
初始版本 |