BGP – Advertising IPv4 and IPv6 in a single BGP session!

First we’re going to be creating a eBGP session with IPv4 and then we will advertise routes for IPv6
Prefixes over that session.

R2 is in AS 1.
R3 is in AS 2.
R2 has a L00pback interface with an IPv6 address of 2002:2::2/128
R3 has a L00pback interface with an IPv6 address of 2003:3::3/128

The link between R2 and R3 is 2.0.0.0/30
R2 is .1
R3 is .2

First we need to enable IPv6 unicast routing on both routers. Remember Ipv4 routing is on by default.

R1 and R2#
Enable
Configure terminal
Ipv6 unicast-routing

 

Now we need to make sure the link between R2 and R3 has IPv4 & 6 reach-ability. Since this is a directly connected link
I can use IPv6 link local addressing. If it wasn’t I would need global unicast IPv6 addressing.

R2#
Enable
Configure terminal
Int g0/2
Ipv6 address autoconfig
Ip address 2.0.0.1 255.255.255.252
No shutdown

—-
I will do the same with R3.
—-

R3#
Enable
Configure terminal
Int g0/1
Ipv6 address autoconfig
Ip address 2.0.0.2 255.255.255.252
No shutdown

Now they both have Ipv6 reachability on this link. I will create a route-map to make sure that the eBGP peer knows what IPv6 address to use as the next hop, or this will never work ( I will use the link local of R2 g0/2 for the nexthop)! Then I will create the eBGP session via IPv4, then setup the ipv6 address family.

 

Note: Again, I am allowed to use the link local IPv6 address of R2 because this a direct link. If we were using eBGP multi-hop, this would not work, I would need to use a IPv6 global unicast address.

 

R2#
Enable
Configure terminal
Route-Map IPV6 permit 10
Set ipv6 next-hop FE80::F816:3EFF:FE40:2985
Exit
Router bgp 1
Neighbor 2.0.0.2 remote-as 2
Address-family ipv6 unicast
Neighbor 2.0.0.2 activate
Neighbor 2.0.0.2 route-map IPV6 out
Network 2002:2::2/128

NOTE: You need to make sure you apply your route-map under the address-family ipv6, it’s very easy to accidently apply it to the ipv4 address family, THAT WILL NOT WORK!

 

Let’s recap what we just did. First we created the route-map that matched all traffic, then we set the next-hop to the ipv6 address of R2’s Ipv6 link local address on G0/2, this is a MUST. Without it, this would not work.

Then we created a eBGP TCP session with 2.0.0.2 (R3’s g0/1 ipv4 address). After that we activated the ipv6 address family, and told it what neighbor to use. (If I was creating a separate eBGP session with IPv6 I would have used the IPv6 address). Then I applied my route-map outward towards my neighbor so that it receives prefixes with the next hop of my link local address  on g0/2.  Finally we advertised our loopback interface’s /128 Ipv6 prefix.

 

Let’s configure R3.
I won’t be explaining the config on R3 because it is very similar.

R3#
Enable
Configure terminal
Route-map IPV6 permit 10
Set ipv6 next-hop FE80::F816:3EFF:FE6E:50EE
Exit
Router bgp 2
Neighbor 2.0.0.1 remote-as 1
Address-family ipv6 unicast
Neighbor 2.0.0.1 activate
Neighbor 2.0.0.1 route-map IPV6 out
network 2003:3::3/128

Normally we would run “show ip bgp” to check the BGP table, but with IPv6 we need to use another command.
By running “show bgp ipv6 unicast” we can see we have a route selected as best path to the Loopback of R2 (confirmed because we see the “>”).

 

I ran a ping from the loopback interface of R3 to the loopback interface of R2, which used the BGP route to get to it.

If the link between R2 and R3 also had global IPv6 Unicast Addressing, those addresses would show up as the next hop along with the Link Local addresses. BGP will prefer the link-local addresse if this is a directly connected link. If this wasn’t a directly connected link then it would obviously only show the global address.