Hello Hemant.
Although I am not Rene or Laz, I’ll do my best to explain this to you.
Remember that we can advertise any routes into BGP by using the network
command as long as they are in the routing table. This includes for example OSPF routes, directly connected routes and even static routes.
What ip route 0.0.0.0 0.0.0.0 Null0
does is that it creates a default static route and adds it into the routing table. This static route points to the Null0 interface which says that anything that matches it should be dropped.
Since this default route is now in the routing table, it can be advertised into BGP, which is what Rene did.
Rene also accompanied it with a prefix list/route-map combination to ensure that only this default route will be advertised to the peers. As you can see, the prefix list only permits specifically the default route - 0.0.0.0/0.
Now to answer your question, won’t the Null0 static route cause all traffic to end up being dropped? Because it points to the Null0 interface.
Let’s review the topology again:
After Rene issued the configuration, the spokes had only the default route in their routing table.
The hub, however, still has the specific routes to the networks behind the spokes (2.2.2.2/32 and 3.3.3.3/32) along with the Null0 route.
Remember that routing is done based off the longest prefix length. So when there are multiple matching routes, the route with the longest prefix length will be used to forward the traffic. Because of this, whenever the spokes use the default route to forward something to the Hub, the Hub will check its routing table and find the following entries:
If the packet is destined to a network behind Spoke1 or Spoke2, the hub will use the specific entries to forward the packet.
So, for example, if the hub receives a packet destined to 2.2.2.2, it will use the BGP route for 2.2.2.2/32.
Since these specific entries are being used, the spokes can happily reach the networks behind eachother, no traffic will be dropped.
The Null0 route will only be used if neither the 2.2.2.2/32 entry or 3.3.3.3/32 entry match the received packet. So if I was to generate a packet destined to 5.5.5.5, for example, this would match only the Null0 route and would be dropped, which makes sense because such network does not exist in our diagram.
So while the spokes will have and only use the default route, the hub will route based off the most specific prefix match.
If anything is still unclear, please let me know.
David