Recently was asked a question on how to advertise specific routes over BGP when the prefix is not in the routing table. We decided to add static Null0 routes and advertise them over the BGP link. I was also provided the below points in choosing the route in the table.
- First the administrative distance (AD) is examined. If there are two entries that the IP address matches with, the entry with the lower AD will be used.
- If the AD is the same, then the more specific entry, that is, the entry with the smallest subnet mask is used.
- If the subnet mask is the same, then the entry with the lowest metric is used.
- If the metric is the same, then load balancing takes place.
The above order seems to be wrong according to some Cisco docs as in.
Should the prefix length triumph over AD ?
Example : 192.168.1.0/24 as connected vs 192.168.1.2/32 as static discarded/Null0 route.
Both the /24 and /32 are on the same switch.
I think 192.168.1.2/32 is preferred over the /24 and the return traffic destined to 192.168.1.2 will come back and the router drops it because /32 is chosen as it’s a Null route.
How can I overcome this issue ? Any ideas