Your browser failed to load CSS style sheets. Your browser or web proxy might not support elliptic-curve TLS

Building network automation solutions

6 week online course

Start now!
back to overview

Can You AS-Prepend a Single Host Route?

Someone recently sent me this question:

Is it possible to prepend one IP address from a public IPv4 segment?

I don’t want to know what crazy stunt this engineer was forced to pull off, but just in case you land in a similar quandary here’s how you shoelace yourself out of it.

Before going into details, do remember that even if you know how to do something, it’s sometimes not recommended (or wise or safe) to do it. You’ve been warned.

  • You can apply BGP AS-path prepending to a route that’s present in the router’s BGP table. To be able to prepend a host prefix, we have to get the host prefix into the BGP table first.
  • To get an IP prefix into the BGP table, it has to be present in the IP routing table first. After you get the IP prefix into the IP routing table you can use network statement or redistribute command to insert it into the BGP table.
  • There are numerous tricks to get a host route into the IP routing table. You could configure a loopback interface on the server and run OSPF with it, use a static route that points to another IP address on that same server (probably even to the same IP address if you specify outgoing interface in the IP static route), use Route Health Injection on a load balancer, or try your luck at internetworking archeology and dig out mobile ARP.

Enterasys has a fully supported feature similar to mobile ARP on their data center switches.

  • Now that you managed to get the host route into the BGP table, create a prefix list to match it, and use the prefix list in a route-map to do all the prepending you want to do.

On, and don’t forget that most ISPs won’t be too happy to see your /32 in their BGP table, so talk with your ISP first, and make sure you tag the host route with no-export community so you don’t pollute the global Internet with your tricks.

MPLS/VPN networks are a different story, MPLS/VPN providers care only about the number of routes you insert into the VPN. Find out the maximum and have a party ;)

2 comments:

  1. Simply put; NO.

    I'm working in an SP, and we will never accept to receive a /32 route except for the RTBH.

    ReplyDelete
  2. Another option would be to use BGP deaggregation, in Cisco the feature for this is Conditional Route Injection. For this you need a longer prefix in order to inject the host or a more specific prefix (it also works to create a copy with the same length of the original prefix). Sometimes might be useful in MPLS/VPN networks.

    ReplyDelete

You don't have to log in to post a comment, but please do provide your real name/URL. Anonymous comments might get deleted.

Sidebar