簡介
本檔案將說明如何使用或不使用回送位址來設定iBGP和eBGP。
必要條件
需求
思科建議您瞭解以下主題:
採用元件
本文件所述內容不限於特定軟體和硬體版本。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
慣例
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
背景資訊
BGP是一種外部閘道通訊協定(EGP),用於在TCP/IP網路中執行網域間路由。在交換BGP更新之前,BGP路由器需要建立到每個BGP對等體的連線(在TCP埠179上)。如果BGP對等點位於不同的自治系統(AS)中,兩個BGP對等點之間的BGP作業階段稱為外部BGP(eBGP)作業階段。如果BGP對等體位於同一個自治系統中,則兩個BGP對等體之間的BGP會話稱為內部BGP(iBGP)會話。
預設情況下,對等體關係是使用最靠近對等路由器的介面的IP地址建立的。但是,當使用neighbor update-source命令時,可以指定任何操作介面(包括環回介面)來建立TCP連線。此與回送介面對等的方法很有用,因為當BGP對等點之間有多個路徑時,此方法無法關閉BGP作業階段。否則當用於建立作業階段的實體介面關閉時,BGP作業階段就會關閉。此外,它還允許執行BGP的路由器(這些路由器之間有多條鏈路)在可用路徑上進行負載均衡。
本文檔中的配置示例針對iBGP和eBGP,包括環回地址和不包括環回地址。
設定
本節包含下一個配置示例:
本節提供用於設定本文件中所述功能的資訊。
注意:要查詢有關本文檔中使用的命令的其他資訊,請使用命令查詢工具。只有註冊的思科使用者才能訪問內部思科資訊和工具。
網路圖表
此文件使用以下網路設定:
iBGP組態
在此配置中,兩台路由器都是inAS 400。
R1-AGS |
R6-2500 |
Current configuration:
!-- Output suppressed.
interface Serial1
ip address 10.10.10.1 255.255.255.0
!
router bgp 400
!--- Enables BGP for the autonomous !--- system 400.
neighbor 10.10.10.2 remote-as 400
!--- Specifies a neighbor 10.10.10.2 !--- in the remote AS 400, making !--- this an iBGP connection.
!-- Output suppressed.
end |
Current configuration:
!-- Output suppressed.
interface Serial0
ip address 10.10.10.2 255.255.255.0
!
router bgp 400
neighbor 10.10.10.1 remote-as 400
!-- Output suppressed.
end |
eBGP組態
在此配置中,路由器R1-AGS在AS 300中,路由器R6-2500在AS 400中。
R1-AGS |
R6-2500 |
Current configuration:
!-- Output suppressed
interface Serial1
ip address 10.10.10.1 255.255.255.0
!
router bgp 300
!--- Enables BGP for the autonomous !--- system 300.
neighbor 10.10.10.2 remote-as 400
!--- Specifies a neighbor 10.10.10.2 !--- in the remote AS 400, making !--- this an eBGP connection.
!-- Output suppressed.
end |
Current configuration:
!-- Output suppressed.
interface Serial0
ip address 10.10.10.2 255.255.255.0
!
router bgp 400
neighbor 10.10.10.1 remote-as 300
!-- Output suppressed.
end |
使用eBGP時,對等點必須直接連線。如果它們沒有直接連線,則必須使用neighbor ebgp-multihop 命令,並且必須存在通過IGP或靜態路由到達對等體的路徑,以便路由器建立鄰居關係。在以前的配置中,R1-AGS路由器屬於AS 300,而R6-2500路由器屬於AS 400。
使用環回地址的iBGP配置
您可以使用環回地址(或任何其他操作介面)配置iBGP,如本節所示。
R1-AGS |
R6-2500 |
Current configuration:
!-- Output suppressed.
interface Loopback0
ip address 10.1.1.1 255.255.255.255
!
interface Serial1
ip address 10.10.10.1 255.255.255.0
!
router bgp 300
neighbor 10.2.2.2 remote-as 300
neighbor 10.2.2.2 update-source Loopback0
!--- This command specifies that the TCP !--- connection with the specified external !--- peer should be established with the !--- address on the loopback interface.
!
ip route 10.2.2.2 255.255.255.255 10.10.10.2
!--- This static route ensures that the !--- remote peer address used for peering !--- is reachable.
!-- Output suppressed.
end |
Current configuration:
!-- Output suppressed.
interface Loopback0
ip address 10.2.2.2 255.255.255.255
!
interface Serial0
ip address 10.10.10.2 255.255.255.0
!
router bgp 300
neighbor 10.1.1.1 remote-as 300
neighbor 10.1.1.1 update-source Loopback0
!
ip route 10.1.1.1 255.255.255.255 10.10.10.1
!-- Output suppressed.
end |
使用環回地址的eBGP配置
您還可以使用環回地址(或任何其他操作介面)配置eBGP,如本節所示。環回介面以此方式使用,以確保具有多個路徑的網路中的可達性,如使用環回位址作為BGP鄰居的負載共用所示。
R1-AGS |
R6-2500 |
Current configuration:
!-- Output suppressed.
interface Loopback0
ip address 10.1.1.1 255.255.255.255
!
interface Serial1
ip address 10.10.10.1 255.255.255.0
!
router bgp 300
neighbor 10.2.2.2 remote-as 400
neighbor 10.2.2.2 ebgp-multihop 2
!--- This command changes the ttl value in !--- order to allow the packet to reach the !--- external BGP peer which is not directly !--- connected or is with an interface other !--- than the directly connected interface.
neighbor 10.2.2.2 update-source Loopback0
!--- This command specifies that the TCP !--- connection with the external BGP !--- peer should be established with the !--- address on the loopback interface.
ip route 10.2.2.2 255.255.255.255 10.10.10.2
!--- This static route ensures that the !--- remote peer address used for peering !--- is reachable.
!-- Output suppressed.
end |
Current configuration:
!-- Output suppressed.
interface Loopback0
ip address 10.2.2.2 255.255.255.255
!
interface Serial0
ip address 10.10.10.2 255.255.255.0
!
router bgp 400
neighbor 10.1.1.1 remote-as 300
neighbor 10.1.1.1 ebgp-multihop 2
neighbor 10.1.1.1 update-source Loopback0
!
ip route 10.1.1.1 255.255.255.255 10.10.10.1
!-- Output suppressed.
end |
驗證
以下各節提供的資訊可用於確認您的配置是否正常工作。輸出直譯器工具支援某些show命令,該工具允許您檢視show命令輸出的分析。
驗證iBGP設定
使用show ip bgp neighbors 命令顯示有關TCP和邊界網關協定(BGP)連線的資訊,並驗證BGP對等體是否已建立。show ip bgp neighbors 命令的輸出將BGP狀態顯示為「Established」,這表示已成功建立BGP對等體關係。
R1-AGS#show ip bgp neighbors | include BGP
BGP neighbor is 10.10.10.2, remote AS 400, internal link
BGP version 4, remote router ID 10.2.2.2
BGP state = Established, up for 00:04:20
BGP table version 1, neighbor version 1
R1-AGS#
show ip bgp neighbors 命令之前已用於修改器| 包括BGP。這樣可使命令輸出更加可讀,並且只顯示相關部分。
此外,show ip bgp summary命令還可用於顯示所有BGP連線的狀態,如下圖所示。
R1-AGS(9)#show ip bgp summary
BGP router identifier 10.1.1.2, local AS number 400
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.10.10.2 4 400 3 3 1 0 0 00:00:26 0
驗證eBGP設定
使用show ip bgp neighbors 命令顯示有關TCP和邊界網關協定(BGP)連線的資訊,並驗證BGP對等體是否已建立。show ip bgp neighbors 命令的輸出將BGP狀態顯示為「Established」,這表示已成功建立BGP對等體關係。
R1-AGS#show ip bgp neighbors | include BGP
BGP neighbor is 10.10.10.2, remote AS 400, external link
BGP version 4, remote router ID 10.2.2.2
BGP state = Established, up for 00:00:17
BGP table version 1, neighbor version 1
此外,show ip bgp summary命令還可用於顯示所有BGP連線的狀態,如下圖所示。
R1-AGS(9)#show ip bgp summary
BGP router identifier 10.10.10.1, local AS number 300
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.10.10.2 4 400 3 3 1 0 0 00:00:26 0
使用環回地址驗證iBGP配置
使用show ip bgp neighbors 命令顯示有關TCP和邊界網關協定(BGP)連線的資訊,並驗證BGP對等體是否已建立。show ip bgp neighbors 命令的輸出將BGP狀態顯示為「Established」,這表示已成功建立BGP對等體關係。
R1-AGS#show ip bgp neighbors | include BGP
BGP neighbor is 10.2.2.2, remote AS 300, internal link
BGP version 4, remote router ID 10.2.2.2
BGP state = Established, up for 00:00:28
BGP table version 1, neighbor version 1
R1-AGS#
此外,show ip bgp summary命令還可用於顯示所有BGP連線的狀態,如下圖所示。
R1-AGS(9)#show ip bgp summary
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.2.2.2 4 400 3 3 1 0 0 00:00:26 0
使用環回地址驗證eBGP配置
使用show ip bgp neighbors 命令顯示有關TCP和邊界網關協定(BGP)連線的資訊,並驗證BGP對等體是否已建立。show ip bgp neighbors 命令的輸出將BGP狀態顯示為「Established」,這表示已成功建立BGP對等體關係。
R1-AGS#show ip bgp neighbors | include BGP
BGP neighbor is 10.2.2.2, remote AS 400, external link
BGP version 4, remote router ID 10.2.2.2
BGP state = Established, up for 00:00:16
BGP table version 1, neighbor version 1
External BGP neighbor may be up to 2 hops away.
此外,show ip bgp summary命令還可用於顯示所有BGP連線的狀態,如下圖所示。
R1-AGS(9)#show ip bgp summary
BGP router identifier 10.1.1.1, local AS number 300
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.2.2.2 4 400 3 3 1 0 0 00:00:26 0
疑難排解
如需詳細資訊,請參閱為什麼BGP鄰居會在空閒、連線和作用中狀態之間切換?和排解常見BGP問題的疑難問題。
相關資訊