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 ;)