Floating static routes with IPv6

15 Feb

Today I was working on my little lab on IPv6. It was a very good labbing day. I found out there is a bug on IOS 15.1(4)M4/M5 for my 1841 regarding ip sla for IPv6 and buffer leaks (I’ll talk about it in the next article); as well I found out that standard IOS commands don’t allow to set up a simple IPv6 floating static router with track. But let me explain exactly what I mean with all this by comparing standard IP config with an equivalent IPv6 one.

Gateway(config)#ip route 1.1.1.1 255.255.255.255 172.16.1.2 ?
  <1-255>    Distance metric for this route
  multicast  multicast route
  name       Specify name of the next hop
  permanent  permanent route
  tag        Set tag for this route
  track      Install route depending on tracked item
  <cr>
Gateway(config)#ip route 1.1.1.1 255.255.255.255 172.16.1.2 track 100
Gateway(config)#do sh track 100
Track 100
  IP SLA 100 reachability
  Reachability is Up
    2 changes, last change 00:02:00
  Latest operation return code: Over threshold
  Latest RTT (millisecs) 19
  Tracked by:
    STATIC-IP-ROUTING 0
Gateway(config)#do sh ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "static", distance 1, metric 0
  Routing Descriptor Blocks:
  * 172.16.1.2
      Route metric is 0, traffic share count is 1
Gateway(config)#no ip sla 100
Feb 14 14:24:09.597: %TRACKING-5-STATE: 100 ip sla 100 reachability Up->Down
Gateway(config)#do sh ip route 1.1.1.1
% Network not in table

 

All simple up to here, we all know that we can track something and install or remove a static route based on the result of the track object. If the track is UP, the route is installed, if not, the route is removed. I wanted to do the same simple config with an IPv6 route, but here the surprise came, the track command is not supported!

Gateway(config)#ipv6 route ::/0 tunnel 0 ?
  <1-255>      Administrative distance
  X:X:X:X::X   IPv6 address of next-hop
  multicast    Route only usable by multicast
  nexthop-vrf  Nexthop IPv6 VRF
  tag          Tag value
  unicast      Route only usable by unicast
  <cr>

 

I have been playing around for a while until I realized that there is simply no way to do it like this. Studying for my CCIE, I recalled that IOS supports some nice features like Embedded Event Manager. Is something that I knew but never had the chance to try, so why not try now? All we need to do is to add a normal static route without any particular option, then configure our ip sla and track object like we would normally do:

!
ipv6 route ::/0 Tunnel0
!
ip sla 1
icmp-echo 2620:0:CCC::2 source-interface Tunnel0
frequency 5
ip sla schedule 1 life forever start-time now
!
track 1 ip sla 1 reachability
delay down 2 up 5
!

 

Now the interesting part come:

!
event manager applet TRACK_IPV6_DOWN
event track 1 state down
action 1.0 syslog msg "EEM applet TRACK_IPV6_DOWN - removing ipv6 static track default route"
action 2.0 cli command "enable"
action 3.0 cli command "conf term"
action 4.0 cli command "no ipv6 route ::/0 Tunnel0"
event manager applet TRACK_IPV6_UP
event track 1 state up
action 1.0 syslog msg "EEM applet TRACK_IPV6_UP - adding ipv6 static track default route"
action 2.0 cli command "enable"
action 3.0 cli command "conf term"
action 4.0 cli command "ipv6 route ::/0 Tunnel0"
!

 

The configuration is straight forward, little explanation is needed. If the track state is down, we manually remove the route, vice versa, if is up, we add it. Also we want to print a syslog message every time an event is triggered. Let’s now verify that it really works now:

Gateway#sh track 1
Track 1
  IP SLA 1 reachability
  Reachability is Up
    3 changes, last change 00:49:17
  Delay up 5 secs, down 2 secs
  Latest operation return code: OK
  Latest RTT (millisecs) 48
  Tracked by:
    EEM applet TRACK_IPV6_UP
    EEM applet TRACK_IPV6_DOWN
Gateway#sh ipv6 route static
IPv6 Routing Table - default - 7 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
       I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
       D - EIGRP, EX - EIGRP external, NM - NEMO, ND - Neighbor Discovery
       l - LISP
       O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
S   ::/0 [1/0]
     via Tunnel0, directly connected
Gateway#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Gateway(config)#ipv6 route 2620:0:CCC::2/128 Null0
Gateway(config)#
Feb 14 14:49:26.893: %TRACKING-5-STATE: 1 ip sla 1 reachability Up->Down
Feb 14 14:49:26.901: %HA_EM-6-LOG: TRACK_IPV6_DOWN: EEM applet TRACK_IPV6_DOWN - removing ipv6 static track default route
Gateway(config)#do sh ipv6 route static
IPv6 Routing Table - default - 7 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
       I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
       D - EIGRP, EX - EIGRP external, NM - NEMO, ND - Neighbor Discovery
       l - LISP
       O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
S   2620:0:CCC::2/128 [1/0]
     via Null0, directly connected
Gateway(config)#no ipv6 route 2620:0:CCC::2/128 Null0
Gateway(config)#
Feb 14 14:50:24.902: %TRACKING-5-STATE: 1 ip sla 1 reachability Down->Up
Feb 14 14:50:24.910: %HA_EM-6-LOG: TRACK_IPV6_UP: EEM applet TRACK_IPV6_UP - adding ipv6 static track default route
Gateway(config)#do sh ipv6 route static
IPv6 Routing Table - default - 7 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
       I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
       D - EIGRP, EX - EIGRP external, NM - NEMO, ND - Neighbor Discovery
       l - LISP
       O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
S   ::/0 [1/0]
     via Tunnel0, directly connected

 

And you? what do you think? Have you faced a similar problem? How did you solved it?

 

Source: http://journey4ccie.com/2013/02/14/floating-static-routes-with-ipv6/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: