Source Based Routing with Cisco

When you are transitioning from one carrier to another using provider allocated IP space there is a neat little trick you can use to route outbound traffic through the correct carrier.  While there are some carrier’s that do not filter their ingress traffic, there are many others who do.

In this example we will assume the following

  1. Carrier A has 192.0.2.0/30 assigned to the wan point-to-point link and has allocated 192.0.2.192/26 for your internal use
  2. Carrier B has 198.51.100.0/30 assigned to the wan point-to-point link and has allocated 198.51.100.192/26 for your internal use
  3. Both carriers are preforming ingress traffic filtering and would block outbound packets not belonging to their ip space
  4. While you can use DHCP to reassign internal users to the new carrier B space there are some statically configured nodes that will need to be able to re-ip when they are ready
  5. You need to migrate without a systems outage caused by moving from one ip to the other
  6. Router Gig0/1 is connected to your internal lan
  7. Router Gig0/2 is connected to carrier A
  8. Router Gig0/3 is connected to carrier B
  9. Your current default route point to the carrier A wan

First you need to create two access lists for each set of internal ip addresses.

ip access-list extended carrier-a
 permit ip 192.0.2.192 0.0.0.127 any
ip access-list extended carrier-b
 permit ip 198.51.100.192 0.0.0.127 any

Next you will need to create a two stanza route map which first does not change the new space, then secondarily forces the old traffic out carrier A

route-map backbones deny 20
 match ip address carrier-b
!
route-map backbones permit 30
 match ip address carrier-a
 set ip next-hop 192.0.2.1

After that you will need to assign the new Policy based routing rule to the Gig0/2 Interface

interface GigabitEthernet0/1
 description Internal Lan
 ip address 192.0.2.193 255.255.255.128 secondary
 ip address 198.51.100.193 255.255.255.128
 ip policy route-map backbones

Last you will need to change the default route from Provider A to Provider B so that traffic normally routes out the new provider.

 ip route 0.0.0.0 0.0.0.0 198.51.100.1
 no ip route 0.0.0.0 0.0.0.0 192.0.2.1

In my next post I will extend this example to apply to migrating from dual carriers with provider space to a RIR allocate with dual routers.

Leave a Reply

Your email address will not be published.