本文档介绍IPv6边界网关协议(BGP)本地首选项功能。本地优先级指示 AS 以哪条路径作为首选来退出 AS,到达特定网络。本地优先级较高的路径优先。首选项的默认值为100。
尝试进行此配置之前,请确保满足以下要求:
了解BGP路由协议及其运行
了解IPv6编址方案
本文档中的信息将在这些软件和硬件版本上进行测试
Cisco IOS 软件版本 12.4,高级 IP 服务功能集
•Cisco 3700 系列多业务接入路由器
有关文档规则的详细信息,请参阅 Cisco 技术提示规则。
在本例中,路由器R1、R2和R3是BGP自治系统编号123的一部分。R4是自治系统101的一部分,R5是自治系统100的一部分。
三台路由器(R1、R2和R3)配置了OSPFv3以实现IGP连接。所有三台路由器的环回接口Lo 0(1111:111:111:A::/64 eui-64、2222:222:222:A::/64 eui-64和3333:333:333:A:::/64 eui-64)的IPv6前缀在OSPFv3路由协议区域0中通告。
路由器R1、R2和R3之间通过学习的环回前缀形成IBGP对等。路由器R1和R4通过WAN链路(串行连接)连接,并形成EBGP对等。同样,路由器R3和R5正在WAN链路上形成EBGP对等。
路由器R4和R5插入相同的IPv6前缀:
network BC01:BC1:10:A::/64
network BC02:BC1:11:A::/64
network BC03:BC1:12:A::/64
由于两台路由器R4和R5插入相同的IPv6前缀,因此路径选择基于BGP公认属性。在本例中,选择Local Preference。通过路由映射为路由器R3上的前缀BC01:BC1:10:A::/64设置BGP本地优先级值500。这会导致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 上
注意:当未配置本地首选项时,路由器R2(Rtr2)将路由器R1(Rtr1)作为其下一跳,用于所有学习的IPv6地址。
注意:前缀BC01:BC1:10:A::/64采用路由器R3的退出路径,因为本地首选项设置得更高。
在路由器R3上
使用这些命令进行故障排除