What is a null route and why do I need one?

Definition

There are several names for a null route, such as a “bit bucket”, a “black hole”, or just a null0 route. They all refer to the same basic mechanism that points traffic to a virtual interface on a router. That in turn is used for managing unwanted traffic to prevent loops or entering routes into the RIB (routing information base) of a router.

Uses

This below is an example of a null route using command syntax from Cisco IOS. There are several other vendors that use similar command syntax and follow the same principles.

ip route 192.168.1.0 255.255.255.0 null0

The purpose of this in terms of discarding traffic is to prevent unwanted traffic from bouncing around via default routes in a loop, and creating unnecessary traffic on the network.

Additional uses for this same command are for route summarization, and route advertisements. This command above enters a route into the RIB (Routing information base) for the subnet in question. This can be used to advertise a summary route from a router so any host looking for this particular network will be directed to the router that originates this null0 route.

This same functionality can be used to test BGP advertisements. A prerequisite for advertising a BGP route is to have the IP range you wish to advertise in the routing table. This can be accomplished by entering the range on an interface, or as you’ve figured out by now you can null route the range since this also enters the range into the routing table (RIB).

Additionally, you can also ‘black hole’ a subnet to prevent users from accessing it at all by routing a valid range to the null0 bit bucket. You could take a public website like Facebook, determine their public IPs, then route that IP space to null0 in your internal core and drop any client requests before they’re even sent out to the internet.

Summary

As you’ve seen, this simple one line command can be utilized in several different ways to prevent loops in your network, enter summary routes into the routing table, test BGP advertisements, or drop unwanted traffic before it consumes any internet bandwidth. This can be a powerful tool in any size network to eliminate unwanted traffic, and manipulate traffic in a simple, efficient way.

Leave a comment