Network Requirements
- Set up IBGP neighbors between Device1 and Device2 and between Device1 and Device3, and set up EBGP neighbors between Device4 and Device2 and between Device4 and Device3.
- Device1 advertises two routes 2001:1::/64 and 2001:2::/64 to Device4, and Device4 advertises two routes 2001:7::/64 and 2001:8::/64 to Device1.
- Modify the Local-preference property of routes on Device2 and Device3 so that Device1 selects route 2001:7::/64 advertised by Device2 and route 2001:8::/64 advertised by Device3 with priority.
- Modify the MED property of routes on Device2 and Device3 so that Device4 selects route 2001:1::/64 advertised by Device3 and route 2001:2::/64 advertised by Device2 with priority.
Network Topology
![Networking for configuring the IPv6 BGP route selection priority](/storage/images/Document/Maipu/unicast-routing/config-ipv6-bgp-route-selection-priority.jpg)
Figure 13–6 Networking for configuring the IPv6 BGP route selection priority
Configuration Steps
Step 1: Configure the IPv6 global unicast addresses of the interfaces. (Omitted)
Step 2: Configure OSPFv3 so that loopback routes are reachable between devices.
#Configure Device1.
Device1#configure terminal
Device1(config)#ipv6 router ospf 100
Device1(config-ospf6)#router-id 1.1.1.1
Device1(config-ospf6)#exit
Device1(config)#interface vlan 2
Device1(config-if-vlan2)#ipv6 router ospf 100 area 0
Device1(config-if-vlan2)#interface vlan3
Device1(config-if-vlan3)#ipv6 router ospf 100 area 0
Device1(config-if-vlan3)#interface loopback 0
Device1(config-if-loopback0)#ipv6 router ospf 100 area 0
Device1(config-if-loopback0)#exit
|
#Configure Device2.
Device2#configure terminal
Device2(config)#ipv6 router ospf 100
Device2(config-ospf6)#router-id 2.2.2.2
Device2(config-ospf6)#exit
Device2(config)#interface vlan 2
Device2(config-if-vlan2)#ipv6 router ospf 100 area 0
Device2(config-if-vlan2)#exit
Device2(config)#interface loopback 0
Device2(config-if-loopback0)#ipv6 router ospf 100 area 0
Device2(config-if-loopback0)#exit
|
#Configure Device3.
Device3#configure terminal
Device3(config)#ipv6 router ospf 100
Device3(config-ospf6)#router-id 3.3.3.3
Device3(config-ospf6)#exit
Device3(config)#interface vlan 2
Device3(config-if-vlan2)#ipv6 router ospf 100 area 0
Device3(config-if-vlan2)#exit
Device3(config)#interface loopback 0
Device3(config-if-loopback0)#ipv6 router ospf 100 area 0
Device3(config-if-loopback0)#exit
|
#View the route table of Device1.
Device1#show ipv6 route
Codes: C - Connected, L - Local, S - static, R - RIP, B - BGP, i-ISIS
U - Per-user Static route
O - OSPF, OE-OSPF External, M - Management
L ::1/128 [0/0]
via ::, 1w5d:04:03:11, lo0
LC 1::1/128 [0/0]
via ::, 00:08:39, loopback0
O 2::2/128 [110/2]
via fe80::201:7aff:fe5e:87da, 00:02:04, vlan2
O 3::3/128 [110/2]
via fe80::201:7aff:fec0:525b, 00:00:38, vlan3
C 2001:1::/64 [0/0]
via ::, 00:09:12, gigabitethernet0/2/3
L 2001:1::1/128 [0/0]
via ::, 00:09:11, lo0
C 2001:2::/64 [0/0]
via ::, 00:08:26, gigabitethernet0/2/2
L 2001:2::1/128 [0/0]
via ::, 00:08:26, gigabitethernet0/2/2
C 2001:3::/64 [0/0]
via ::, 00:09:01, vlan2
L 2001:3::1/128 [0/0]
via ::, 00:09:00, lo0
C 2001:4::/64 [0/0]
via ::, 00:08:55, vlan3
L 2001:4::1/128 [0/0]
via ::, 00:08:53, lo0
#View the route table of Device2.
Device2#show ipv6 route
Codes: C - Connected, L - Local, S - static, R - RIP, B - BGP, i-ISIS
U - Per-user Static route
O - OSPF, OE-OSPF External, M - Management
L ::1/128 [0/0]
via ::, 2w4d:23:16:51, lo0
O 1::1/128 [110/2]
via fe80::201:7aff:fe62:bb7f, 00:04:25, vlan2
LC 2::2/128 [0/0]
via ::, 00:09:31, loopback0
O 3::3/128 [110/3]
via fe80::201:7aff:fe62:bb7f, 00:02:52, vlan2
C 2001:3::/64 [0/0]
via ::, 00:09:49, vlan2
L 2001:3::2/128 [0/0]
via ::, 00:09:48, lo0
O 2001:4::/64 [110/2]
via fe80::201:7aff:fe62:bb7f, 00:04:25, vlan2
C 2001:5::/64 [0/0]
via ::, 00:09:39, vlan3
L 2001:5::2/128 [0/0]
via ::, 00:09:38, lo0
#View the route table of Device3.
Device3#show ipv6 route
Codes: C - Connected, L - Local, S - static, R - RIP, B - BGP, i-ISIS
U - Per-user Static route
O - OSPF, OE-OSPF External, M - Management
L ::1/128 [0/0]
via ::, 2w1d:22:16:55, lo0
O 1::1/128 [110/2]
via fe80::201:7aff:fe62:bb80, 00:04:27, vlan2
O 2::2/128 [110/3]
via fe80::201:7aff:fe62:bb80, 00:04:27, vlan2
LC 3::3/128 [0/0]
via ::, 00:10:48, loopback0
O 2001:3::/64 [110/2]
via fe80::201:7aff:fe62:bb80, 00:04:27, vlan2
C 2001:4::/64 [0/0]
via ::, 00:11:55, vlan2
L 2001:4::2/128 [0/0]
via ::, 00:11:54, lo0
C 2001:6::/64 [0/0]
via ::, 00:11:48, vlan3
L 2001:6::2/128 [0/0]
via ::, 00:11:47, lo0
According to the route table, Device1, Device2, and Device3 have learnt the routes of the loopback interfaces of each other.
Step 3: Configure the IPv6 BGP basic functions.
#Configure Device1.
Device1(config)#router bgp 100
Device1(config-bgp)#bgp router-id 1.1.1.1
Device1(config-bgp)#address-family ipv6
Device1(config-bgp-af)#neighbor 2::2 remote-as 100
Device1(config-bgp-af)#neighbor 3::3 remote-as 100
Device1(config-bgp-af)#network 2001:1::/64
Device1(config-bgp-af)#network 2001:2::/64
Device1(config-bgp-af)#exit-address-family
Device1(config-bgp)#neighbor 2::2 update-source loopback 0
Device1(config-bgp)#neighbor 3::3 update-source loopback 0
Device1(config-bgp)#exit
|
#Configure Device2.
Device2(config)#router bgp 100
Device2(config-bgp)#bgp router-id 2.2.2.2
Device2(config-bgp)#address-family ipv6
Device2(config-bgp-af)#neighbor 1::1 remote-as 100
Device2(config-bgp-af)#neighbor 1::1 next-hop-self
Device2(config-bgp-af)#neighbor 2001:5::1 remote-as 200
Device2(config-bgp-af)#exit-address-family
Device2(config-bgp)#neighbor 1::1 update-source loopback 0
Device2(config-bgp)#exit
|
#Configure Device3.
Device3(config)#router bgp 100
Device3(config-bgp)#bgp router-id 3.3.3.3
Device3(config-bgp)#address-family ipv6
Device3(config-bgp-af)#neighbor 1::1 remote-as 100
Device3(config-bgp-af)#neighbor 1::1 next-hop-self
Device3(config-bgp-af)#neighbor 2001:6::1 remote-as 200
Device3(config-bgp-af)#exit-address-family
Device3(config-bgp)#neighbor 1::1 update-source loopback 0
Device3(config-bgp)#exit
|
#Configure Device4.
Device4#configure terminal
Device4(config)#router bgp 200
Device4(config-bgp)#bgp router-id 4.4.4.4
Device4(config-bgp)#address-family ipv6
Device4(config-bgp-af)#neighbor 2001:5::2 remote-as 100
Device4(config-bgp-af)#neighbor 2001:6::2 remote-as 100
Device4(config-bgp-af)#network 2001:7::/64
Device4(config-bgp-af)#network 2001:8::/64
Device4(config-bgp-af)#exit-address-family
Device4(config-bgp)#exit
|
#On Device1, check the IPv6 BGP neighbor status.
Device1#show bgp ipv6 unicast summary
BGP router identifier 1.1.1.1, local AS number 100
BGP table version is 4
2 BGP AS-PATH entries
0 BGP community entries
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2::2 4 100 9 10 4 0 0 00:06:18 2
3::3 4 100 7 8 4 0 0 00:04:29 2
Total number of neighbors 2
#On Device4, check the IPv6 BGP neighbor status.
Device4#show bgp ipv6 unicast summary
BGP router identifier 4.4.4.4, local AS number 200
BGP table version is 4
2 BGP AS-PATH entries
0 BGP community entries
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2001:5::2 4 100 6 5 4 0 0 00:02:43 2
2001:6::2 4 100 5 6 4 0 0 00:02:32 2
Total number of neighbors 2
IBGP neighbors have been set up between Device1 and Device2 and between Device2 and Device3, and EBGP neighbors have been set up between Device4 and Device2 and between Device4 and Device3.
#View the route table of Device1.
Device1#show bgp ipv6 unicast
BGP table version is 4, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
[B]*> 2001:1::/64 :: 0 32768 i
[B]*> 2001:2::/64 :: 0 32768 i
[B]* i 2001:7::/64 3::3 0 100 0 200 i
[B]*>i 2::2 0 100 0 200 i
[B]*>i2001:8::/64 2::2 0 100 0 200 i
[B]* i 3::3 0 100 0 200 i
Device1#show ipv6 route
Codes: C - Connected, L - Local, S - static, R - RIP, B - BGP, i-ISIS
U - Per-user Static route
O - OSPF, OE-OSPF External, M - Management
L ::1/128 [0/0]
via ::, 1w5d:04:20:19, lo0
LC 1::1/128 [0/0]
via ::, 00:25:47, loopback0
O 2::2/128 [110/2]
via fe80::201:7aff:fe5e:87da, 00:19:12, vlan2
O 3::3/128 [110/2]
via fe80::201:7aff:fec0:525b, 00:17:46, vlan3
C 2001:1::/64 [0/0]
via ::, 00:26:20, gigabitethernet0/2/3
L 2001:1::1/128 [0/0]
via ::, 00:26:19, lo0
C 2001:2::/64 [0/0]
via ::, 00:25:34, gigabitethernet0/2/2
L 2001:2::1/128 [0/0]
via ::, 00:25:34, gigabitethernet0/2/2
C 2001:3::/64 [0/0]
via ::, 00:26:09, vlan2
L 2001:3::1/128 [0/0]
via ::, 00:26:08, lo0
C 2001:4::/64 [0/0]
via ::, 00:26:03, vlan3
L 2001:4::1/128 [0/0]
via ::, 00:26:01, lo0
B 2001:7::/64 [200/0]
via 2::2, 00:03:21, vlan2
B 2001:8::/64 [200/0]
via 2::2, 00:02:57, vlan2
According to the route table, both route 2001:7::/64 and route 2001:8::/64 of Device1 select Device2 as the next-hop device.
#Query the route table of Device4.
Device4#show bgp ipv6 unicast
BGP table version is 4, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
[B]* 2001:1::/64 2001:6::2 0 0 100 i
[B]*> 2001:5::2 0 0 100 i
[B]* 2001:2::/64 2001:6::2 0 0 100 i
[B]*> 2001:5::2 0 0 100 i
[B]*> 2001:7::/64 :: 0 32768 i
[B]*> 2001:8::/64 :: 0 32768 i
Device4#show ipv6 route
Codes: C - Connected, L - Local, S - static, R - RIP, B - BGP, i-ISIS
U - Per-user Static route
O - OSPF, OE-OSPF External, M - Management
L ::1/128 [0/0]
via ::, 1w5d:04:14:15, lo0
B 2001:1::/64 [20/0]
via 2001:5::2, 00:06:52, vlan2
B 2001:2::/64 [20/0]
via 2001:5::2, 00:06:52, vlan2
C 2001:5::/64 [0/0]
via ::, 00:26:17, vlan2
L 2001:5::1/128 [0/0]
via ::, 00:26:16, lo0
C 2001:6::/64 [0/0]
via ::, 00:26:24, vlan3
L 2001:6::1/128 [0/0]
via ::, 00:26:23, lo0
C 2001:7::/64 [0/0]
via ::, 00:25:53, gigabitethernet0/2/3
L 2001:7::1/128 [0/0]
via ::, 00:25:51, lo0
C 2001:8::/64 [0/0]
via ::, 00:25:40, gigabitethernet0/2/2
L 2001:8::1/128 [0/0]
via ::, 00:25:40, gigabitethernet0/2/2
Both route 2001:1::/64 and 2001:2::/64 of Device4 select Device3 as the next-hop device.
Step 4: Configure an ACL and routing policy to set local-preference and metric.
#Configure Device2.
Device2(config)#ipv6 access-list extended 7001
Device2(config-v6-list)#permit ipv6 2001:8::/64 any
Device2(config-v6-list)#commit
Device2(config-v6-list)#exit
Device2(config)#ipv6 access-list extended 7002
Device2(config-v6-list)#permit ipv6 2001:1::/64 any
Device2(config-v6-list)#commit
Device2(config-v6-list)#exit
Device2(config)#route-map SetPriority1 10
Device2(config-route-map)#match ipv6 address 7001
Device2(config-route-map)#set local-preference 110
Device2(config-route-map)#exit
Device2(config)#route-map SetPriority1 20
Device2(config-route-map)#set local-preference 20
Device2(config-route-map)#exit
Device2(config)#route-map SetPriority2 10
Device2(config-route-map)#match ipv6 address 7002
Device2(config-route-map)#set metric 100
Device2(config-route-map)#exit
Device2(config)#route-map SetPriority2 20
Device2(config-route-map)#set metric 20
Device2(config-route-map)#exit
|
On Device2, configure a routing policy to set local-preference of route 2001:8::/64 to 110, and set metric of route 2001:1::/64 to 100.
#Configure Device3.
Device3(config)#ipv6 access-list extended 7001
Device3(config-v6-list)#permit ipv6 2001:7::/64 any
Device2(config-v6-list)#commit
Device3(config-v6-list)#exit
Device3(config)#ipv6 access-list extended 7002
Device3(config-v6-list)#permit ipv6 2001:2::/64 any
Device2(config-v6-list)#commit
Device3(config-v6-list)#exit
Device3(config)#route-map SetPriority1 10
Device3(config-route-map)#match ipv6 address 7001
Device3(config-route-map)#set local-preference 110
Device3(config-route-map)#exit
Device3(config)#route-map SetPriority1 20
Device3(config-route-map)#exit
Device3(config)#route-map SetPriority2 10
Device3(config-route-map)#match ipv6 address 7002
Device3(config-route-map)#set metric 100
Device3(config-route-map)#exit
Device3(config)#route-map SetPriority2 20
Device3(config-route-map)#exit
|
On Device3, configure a routing policy to set local-preference of route 2001:7::/64 to 110, and set metric of route 2001:2::/64 to 100.
![note](/storage/images/Document/Maipu/note-icon.jpg)
-
In configuring a routing policy, you can create a filtration rule based on a prefix list or ACL. The prefix list can precisely match routing masks while the ACL cannot match routing masks.
Step 5: Configure a routing policy for IPv6 BGP.
#Configure Device2.
Device2(config)#router bgp 100
Device2(config-bgp)#address-family ipv6
Device2(config-bgp-af)#neighbor 1::1 route-map SetPriority1 out
Device2(config-bgp-af)#neighbor 2001:5::1 route-map SetPriority2 out
Device2(config-bgp-af)#exit-address-family
Device2(config-bgp)#exit
|
On Device2, configure the outgoing direction of neighbor 1::1 to modify local-preference of route 2001:8::/64, and configure the outgoing direction of neighbor 2001:5::1 to modify metric of route 2001:1::/64.
#Configure Device3.
Device3(config)#router bgp 100
Device3(config-bgp)#address-family ipv6
Device3(config-bgp-af)#neighbor 1::1 route-map SetPriority1 out
Device3(config-bgp-af)#neighbor 2001:6::1 route-map SetPriority2 out
Device3(config-bgp-af)# exit-address-family
Device2(config-bgp)#exit
|
On Device3, configure the outgoing direction of neighbor 10.0.0.1 to modify local-preference of route 2001:7::/64, and configure the outgoing direction of neighbor 2001:6::1 to modify metric of route2001:2::/64.
After a routing policy is configured on the neighbor, you need to reset the neighbor.
Step 6: Check the result.
#View the route table of Device1.
Device1#show bgp ipv6 unicast
BGP table version is 9, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
[B]*> 2001:1::/64 :: 0 32768 i
[B]*> 2001:2::/64 :: 0 32768 i
[B]* i 2001:7::/64 2::2 0 100 0 200 i
[B]*>i 3::3 0 110 0 200 i
[B]*>i 2001:8::/64 2::2 0 110 0 200 i
[B]* i 3::3 0 100 0 200 i
Device1#show ipv6 route
Codes: C - Connected, L - Local, S - static, R - RIP, B - BGP, i-ISIS
U - Per-user Static route
O - OSPF, OE-OSPF External, M - Management
L ::1/128 [0/0]
via ::, 1w5d:04:59:59, lo0
LC 1::1/128 [0/0]
via ::, 01:05:27, loopback0
O 2::2/128 [110/2]
via fe80::201:7aff:fe5e:87da, 00:58:52, vlan3
O 3::3/128 [110/2]
via fe80::201:7aff:fec0:525b, 00:57:26, gigabitethernet0/2/2
C 2001:1::/64 [0/0]
via ::, 01:06:00, vlan2
L 2001:1::1/128 [0/0]
via ::, 01:05:59, lo0
C 2001:2::/64 [0/0]
via ::, 01:05:14, loopback1
L 2001:2::1/128 [0/0]
via ::, 01:05:14, loopback1
C 2001:3::/64 [0/0]
via ::, 01:05:49, vlan3
L 2001:3::1/128 [0/0]
via ::, 01:05:48, lo0
C 2001:4::/64 [0/0]
via ::, 01:05:43, gigabitethernet0/2/2
L 2001:4::1/128 [0/0]
via ::, 01:05:41, lo0
B 2001:7::/64 [200/0]
via 3::3, 00:09:05, vlan3
B 2001:8::/64 [200/0]
via 2::2, 00:04:58, vlan2
According to the route table, local-preference of routes 2001:7::/64 and 2001:8::/64 is modified successfully, and Device1 select route 2001:8::/64 that is advertised by Device2 and route2001:7::/64 that is advertised by Device3 with priority.
#Query the route table of Device4.
Device4#show bgp ipv6 unicast
BGP table version is 5, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
[B]* 2001:1::/64 2001:5::2 100 0 100 i
[B]*> 2001:6::2 0 0 100 i
[B]*> 2001:2::/64 2001:5::2 0 0 100 i
[B]* 2001:6::2 100 0 100 i
[B]*> 2001:7::/64 :: 0 32768 i
[B]*> 2001:8::/64 :: 0 32768 i
Device4#show ipv6 route
Codes: C - Connected, L - Local, S - static, R - RIP, B - BGP, i-ISIS
U - Per-user Static route
O - OSPF, OE-OSPF External, M - Management
L ::1/128 [0/0]
via ::, 1w5d:04:53:45, lo0
B 2001:1::/64 [20/0]
via 2001:6::2, 00:12:10, vlan3
B 2001:2::/64 [20/0]
via 2001:5::2, 00:07:40, vlan2
C 2001:5::/64 [0/0]
via ::, 01:05:47, vlan2
L 2001:5::1/128 [0/0]
via ::, 01:05:46, lo0
C 2001:6::/64 [0/0]
via ::, 01:05:54, vlan3
L 2001:6::1/128 [0/0]
via ::, 01:05:52, lo0
C 2001:7::/64 [0/0]
via ::, 01:05:22, gigabitethernet0/2/3
L 2001:7::1/128 [0/0]
via ::, 01:05:21, lo0
C 2001:8::/64 [0/0]
via ::, 01:05:09, gigabitethernet0/2/2
L 2001:8::1/128 [0/0]
via ::, 01:05:09, gigabitethernet0/2/2
According to the route table, metric of routes 2001:1::/64 and 2001:2::/64 is modified successfully, and Device4 select route 2001:2::/64 that is advertised by Device2 and route 2001:1::/64 that is advertised by Device3 with priority.
![note](/storage/images/Document/Maipu/note-icon.jpg)
-
A routing policy can be used in the outgoing direction of route advertisement, and it can also be used in the incoming direction of route receiving.