本檔案將說明IPv6邊界閘道通訊協定(BGP)Local-Preference功能。本地優先順序是指AS哪條路徑優先退出AS以到達特定網路。具有更高本地優先順序的路徑更優先。優先順序的預設值為100。
嘗試此組態之前,請確保符合以下要求:
瞭解BGP路由協定及其操作
瞭解IPv6編址方案
本檔案中的資訊已使用以下軟體和硬體版本進行測試
Cisco IOS軟體版本12.4,高級IP服務功能集
· Cisco 3700系列多重服務存取路由器
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
在本例中,路由器R1、R2和R3屬於BGP自治系統編號123。R4屬於自治系統101,R5屬於自治系統100。
三台路由器(R1、R2和R3)配置了OSPFv3以實現IGP連線。所有三台路由器的環回介面Lo 0(1111:111:A::/64 eui-64、222:222:222:A::/64 eui-64和333:333:333:A::/64 eui-64)的IPv6字首在OSPFv3路由協定的區域0中通告。
路由器R1、R2和R3之間通過獲知的環回字首形成IBGP對等。路由器R1和R4通過WAN鏈路(串列連線)連線,形成EBGP對等。同樣,路由器R3和R5正在通過WAN鏈路形成EBGP對等。
路由器R4和R5插入相同的IPv6字首:
網路BC01:BC1:10:A::/64
網路BC02:BC1:11:A::/64
網路BC03:BC1:12:A::/64
由於兩台路由器R4和R5插入了相同的IPv6字首,因此路徑選擇基於BGP已知屬性。在本示例中,選擇了Local Preference。BGP本地優先順序值500通過路由對映為路由器R3上的字首BC01:BC1:10:A::/64設定。這會導致R3成為此字首的退出點,而R1成為其餘兩個字首的退出點。
路由器R1、R2和R3的快速乙太網介面(F0/0和F0/1)啟用了IPv6,IPv6地址格式為eui-64。
本檔案會使用以下網路設定:
本檔案會使用以下設定:
注意:使用ipv6 unicast-routing命令,所有路由器都啟用了IPv6資料包轉發功能。
R1 |
---|
interface Loopback0 no ip address ipv6 address 1111:111:111:A::/64 eui-64 ipv6 enable ipv6 ospf 10 area 0 !--- Enables OSPFv3 on the interface and associates !--- the interface loopback0 to area 0. ! interface FastEthernet0/0 description CONNECTED TO Rtr2 no ip address duplex auto speed auto ipv6 address AB01:CD1:123:A::/64 eui-64 ipv6 enable ipv6 ospf 10 area 0 ! interface Serial0/0 no ip address ipv6 address AB01:CD1:123:C::/64 eui-64 ipv6 enable clock rate 2000000 ! interface FastEthernet0/1 no ip address duplex auto speed auto ipv6 address AB01:CD1:123:B::/64 eui-64 ipv6 enable ipv6 ospf 10 area 0 ! ipv6 router ospf 10 router-id 1.1.1.1 log-adjacency-changes redistribute connected route-map CONNECTED ! route-map CONNECTED permit 10 match interface Serial0/0 ! router bgp 123 bgp router-id 1.1.1.1 no bgp default ipv4-unicast bgp log-neighbor-changes neighbor 2222:222:222:A:C602:3FF:FEF0:0 remote-as 123 neighbor 2222:222:222:A:C602:3FF:FEF0:0 update-source Loopback0 neighbor 3333:333:333:A:C603:3FF:FEF0:0 remote-as 123 neighbor 3333:333:333:A:C603:3FF:FEF0:0 update-source Loopback0 neighbor AB01:CD1:123:C:C604:16FF:FE98:0 remote-as 101 neighbor AB01:CD1:123:C:C604:16FF:FE98:0 ebgp-multihop 5 ! address-family ipv6 neighbor 2222:222:222:A:C602:3FF:FEF0:0 activate neighbor 2222:222:222:A:C602:3FF:FEF0:0 next-hop-self neighbor 3333:333:333:A:C603:3FF:FEF0:0 activate neighbor 3333:333:333:A:C603:3FF:FEF0:0 next-hop-self neighbor AB01:CD1:123:C:C604:16FF:FE98:0 activate exit-address-family |
R2 |
---|
interface Loopback0 no ip address ipv6 address 2222:222:222:A::/64 eui-64 ipv6 enable ipv6 ospf 10 area 0 ! interface FastEthernet0/0 no ip address duplex auto speed auto ipv6 address AB01:CD1:123:A::/64 eui-64 ipv6 ospf 10 area 0 ! interface FastEthernet0/1 no ip address duplex auto speed auto ipv6 address AB01:CD1:123:D::/64 eui-64 ipv6 enable ipv6 ospf 10 area 0 ! ipv6 router ospf 10 router-id 2.2.2.2 log-adjacency-changes ! router bgp 123 no synchronization bgp router-id 2.2.2.2 bgp log-neighbor-changes neighbor 1111:111:111:A:C601:3FF:FEF0:0 remote-as 123 neighbor 1111:111:111:A:C601:3FF:FEF0:0 update-source Loopback0 neighbor 3333:333:333:A:C603:3FF:FEF0:0 remote-as 123 neighbor 3333:333:333:A:C603:3FF:FEF0:0 update-source Loopback0 no auto-summary ! address-family ipv6 neighbor 1111:111:111:A:C601:3FF:FEF0:0 activate neighbor 3333:333:333:A:C603:3FF:FEF0:0 activate exit-address-family |
R3 |
---|
interface Loopback0 no ip address ipv6 address 3333:333:333:A::/64 eui-64 ipv6 enable ipv6 ospf 10 area 0 ! interface FastEthernet0/0 no ip address duplex auto speed auto ipv6 address AB01:CD1:123:B::/64 eui-64 ipv6 enable ipv6 ospf 10 area 0 ! interface Serial0/0 no ip address ipv6 address AB01:CD1:123:E::/64 eui-64 ipv6 enable clock rate 2000000 ! interface FastEthernet0/1 no ip address duplex auto speed auto ipv6 address AB01:CD1:123:D::/64 eui-64 ipv6 ospf 10 area 0 ! ipv6 router ospf 10 router-id 3.3.3.3 log-adjacency-changes redistribute connected route-map CONNECTED ! router bgp 123 no synchronization bgp router-id 3.3.3.3 bgp log-neighbor-changes neighbor 1111:111:111:A:C601:3FF:FEF0:0 remote-as 123 neighbor 1111:111:111:A:C601:3FF:FEF0:0 update-source Loopback0 neighbor 2222:222:222:A:C602:3FF:FEF0:0 remote-as 123 neighbor 2222:222:222:A:C602:3FF:FEF0:0 update-source Loopback0 neighbor AB01:CD1:123:E:C605:16FF:FE98:0 remote-as 202 neighbor AB01:CD1:123:E:C605:16FF:FE98:0 ebgp-multihop 5 no auto-summary ! address-family ipv6 neighbor 1111:111:111:A:C601:3FF:FEF0:0 activate neighbor 1111:111:111:A:C601:3FF:FEF0:0 next-hop-self neighbor 1111:111:111:A:C601:3FF:FEF0:0 route-map LOCAL_PREF out neighbor 2222:222:222:A:C602:3FF:FEF0:0 activate neighbor 2222:222:222:A:C602:3FF:FEF0:0 next-hop-self neighbor 2222:222:222:A:C602:3FF:FEF0:0 route-map LOCAL_PREF out neighbor AB01:CD1:123:E:C605:16FF:FE98:0 activate exit-address-family ! ipv6 prefix-list 10 seq 5 permit BC01:BC1:10:A::/64 ! route-map LOCAL_PREF permit 10 match ipv6 address prefix-list 10 set local-preference 500 ! route-map LOCAL_PREF permit 20 ! route-map CONNECTED permit 10 match interface Serial0/0 |
R4 |
---|
interface Serial0/0 no ip address ipv6 address AB01:CD1:123:C::/64 eui-64 ipv6 enable clock rate 2000000 ! interface Loopback10 no ip address ipv6 address BC01:BC1:10:A::/64 eui-64 ipv6 enable ! interface Loopback11 no ip address ipv6 address BC02:BC1:11:A::/64 eui-64 ipv6 enable ! interface Loopback12 no ip address ipv6 address BC03:BC1:12:A::/64 eui-64 ipv6 enable router bgp 101 bgp router-id 4.4.4.4 no bgp default ipv4-unicast bgp log-neighbor-changes neighbor AB01:CD1:123:C:C601:3FF:FEF0:0 remote-as 123 neighbor AB01:CD1:123:C:C601:3FF:FEF0:0 ebgp-multihop 5 ! address-family ipv6 neighbor AB01:CD1:123:C:C601:3FF:FEF0:0 activate network BC01:BC1:10:A::/64 network BC02:BC1:11:A::/64 network BC03:BC1:12:A::/64 exit-address-family |
R5 |
---|
interface Serial0/0 no ip address ipv6 address AB01:CD1:123:E::/64 eui-64 ipv6 enable clock rate 2000000 ! interface Loopback10 no ip address ipv6 address BC01:BC1:10:A::/64 eui-64 ipv6 enable ! interface Loopback11 no ip address ipv6 address BC02:BC1:11:A::/64 eui-64 ipv6 enable ! interface Loopback12 no ip address ipv6 address BC03:BC1:12:A::/64 eui-64 ipv6 enable ! router bgp 202 bgp router-id 5.5.5.5 no bgp default ipv4-unicast bgp log-neighbor-changes neighbor AB01:CD1:123:E:C603:3FF:FEF0:0 remote-as 123 neighbor AB01:CD1:123:E:C603:3FF:FEF0:0 ebgp-multihop 5 ! address-family ipv6 neighbor AB01:CD1:123:E:C603:3FF:FEF0:0 activate network BC01:BC1:10:A::/64 network BC02:BC1:11:A::/64 network BC03:BC1:12:A::/64 exit-address-family |
本節提供的資訊可用於確認您的組態是否正常運作。
在路由器R1上
在路由器R2上
注意:未配置Local Preference時,路由器R2(Rtr2)將路由器R1(Rtr1)作為所有已學習IPv6地址的下一跳。
注意:字首BC01:BC1:10:A::/64採用路由器R3的退出路徑,因為「本地首選項」設定得更高。
在路由器R3上
使用這些命令進行故障排除