BGP: Create non-existent entry in CP RIB to advertise entire subnet.


The way BGP advertises routes to peers is via network command. However unlike other IGP(e.g OSPF , EIGRP etc) which summerises the entire network.

For example to advertise and summarise an entire /16 network in an IGP (ospf in our example) you would use the following network command: – =

RouterA(config-router): network area 0

On the above network statement OSPF will advertise all interfaces under that network for example based on the above it will advertise and 172.16.10/24. Are you following?

You see OSPF advertises on the interface level. The OSPF DR and the OSPF BDR router will advertise and interfaces to all adjacent routers. OSPF wIll advertise to multicast using “hello”. It will not advertise the directly even though it was in the network statement above.

In BGP, the network statement actually inherently equates to “please advertise this network”. Unlike OSPF we are not enabling BGP on a particular interface. Remember BGP doesn’t use multicast, it’s using direct TCP connection on port 179 to perform peering between neighbours. Adjacent routers are peered and are neighbours, they are not advertising any “networks”.

To provide you with an accurate “wording”, under IGP(OSPF) network statement we are “enabling” OSPF for a particular interface on the router to be advertised. However what makes BGP different(special) is that we are not “enabling” BGP for a interface we are “advertising” the networks.

Subsequently we must advertise BGP network specifically. For example and we cannot advertise to advertise both of those network because is not in the control planes RIB. BGP requires the exact mask for a network in order to advertise.

So for example if we need to advertise those network interfaces in BGP we will have to perform the following on the router:

network mask 
network mask

We will have to continue to enable the router interfaces separately…..

The Static Null route: Advertise an entire subnet in BGP

A null route in the control RIB does something fairly simple, it will essentially drop the packet heading to a particular network. It’s mainly utilised to prevent loops and for security purposes. It’s an important tool to prevent loops for example let’s a packet arrives from another router in a neighbouring BGP AS. If it’s destination is down for whatever reason the router will automatically forward to the default route and it will be inherently be routed back again creating “routing loop”.

In order to inject a null static route for example:

ip route null0

Remember in BGP we cannot advertise a network that is NOT in the control planes RIB(routing table) by creating the above static route, we have now injected the above network into the RIB.

Then under the BGP AS statement we would simply advertise the following:

network mask

Subsequently one may assume, why? We are going drop all packets destined for Doesn’t make any sense correct?


Let’s say a IP packet comes in with destination IP field header of . The router will perform a lookup of its control plane RIB. Remember from the my previous post. It will match and it will also match

The prefix will be the longest match, subsequently it will not drop the packet. The FIB will forward the packet to the and the adjacency table will have a pre-made frame header to the interface L2 address then it is forwarded to the corresponding interface.

No need to advertise specific masks in BGP

We can’t advertise entire network in BGP (e.g remember we have to be specific with masks in BGP (e.g etc)

Which inherently means we must advertise a peers networks individually.

However with this small trick, we can now advertise all networks under with single command, as opposed individually. Simply by inserting the static null route into the control planes RIB(routing table).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s