Link to home
Start Free TrialLog in
Avatar of jskfan
jskfanFlag for Cyprus

asked on

ip route 0.0.0.0 0.0.0.0 null0

ip route 0.0.0.0 0.0.0.0 null0

I would like to know what is the purpose of ip route 0.0.0.0 0.0.0.0 null0  in this configuration  below

Thank you

Hub(config)#ip route 0.0.0.0 0.0.0.0 null0

Hub(config)#ip prefix-list DEFAULT_ROUTE permit 0.0.0.0/0

Hub(config)#route-map SPOKE_ROUTERS permit 10
Hub(config-route-map)#match ip address prefix-list DEFAULT_ROUTE

Hub(config)#router bgp 65001
Hub(config-router)#network 0.0.0.0 mask 0.0.0.0
Hub(config-router)#neighbor 172.16.123.2 route-map SPOKE_ROUTERS out
Hub(config-router)#neighbor 172.16.123.3 route-map SPOKE_ROUTERS out

Open in new window

Avatar of masnrock
masnrock
Flag of United States of America image

It's a default route. If for some reason packets are supposed to be bound for an unknown destination, the router will drop them.
It looks like this default null route was added to ensure that there is always a default route in the routing table so that BGP will always advertise the route to its peers. Since this isn’t tied with an interface, there is no chance that it will be removed from the routing table. There is most likely an interior protocol running that will have more specific routes for your environment.

 As mentioned above, if there is no more specific route the traffic will be dropped.
Avatar of jskfan

ASKER

Hub(config)#ip route 0.0.0.0 0.0.0.0 null0

the way I understand the command above is any traffic that leaves the Hub router will be discarded.. Not sure why is configured that way ...

in the other hand the Hub router is permitting default route to go out to its neighbors

Hub(config-router)#neighbor 172.16.123.2 route-map SPOKE_ROUTERS out
Hub(config-router)#neighbor 172.16.123.3 route-map SPOKE_ROUTERS out
Kevin is correct. This is in order for BGP to advertise a default route by forcing it in the RIB with the static route to null.
Avatar of jskfan

ASKER

Soulja

If I understand to advertise , we need to use the command Network.....
above it is : routing traffic :
Hub(config)#ip route 0.0.0.0 0.0.0.0 null0

then  permitting default route to go out to its neighbors

Hub(config-router)#neighbor 172.16.123.2 route-map SPOKE_ROUTERS out
Hub(config-router)#neighbor 172.16.123.3 route-map SPOKE_ROUTERS out

I do not get the meaning of the configuration below, any one can comment it line by line ?

Hub(config)#ip route 0.0.0.0 0.0.0.0 null0

Hub(config)#ip prefix-list DEFAULT_ROUTE permit 0.0.0.0/0

Hub(config)#route-map SPOKE_ROUTERS permit 10
Hub(config-route-map)#match ip address prefix-list DEFAULT_ROUTE

Hub(config)#router bgp 65001
Hub(config-router)#network 0.0.0.0 mask 0.0.0.0
Hub(config-router)#neighbor 172.16.123.2 route-map SPOKE_ROUTERS out
Hub(config-router)#neighbor 172.16.123.3 route-map SPOKE_ROUTERS out

Open in new window

Avatar of jskfan

ASKER

in other words if the configuration of the router Hub above did not have this line:
Hub(config)#ip route 0.0.0.0 0.0.0.0 null0

it would have made sense to me
I went ahead and went through the config line by line as requested.


Hub(config)#ip route 0.0.0.0 0.0.0.0 null0  
Static route that matches against all traffic and forwards to a null interface

Hub(config)#ip prefix-list DEFAULT_ROUTE permit 0.0.0.0/0
Prefix list that will only match on the default route

Hub(config)#route-map SPOKE_ROUTERS permit 10              
route map with a permit entry of 10
Hub(config-route-map)#match ip address prefix-list DEFAULT_ROUTE
Uses the prefix list from above. Since route map is permit and prefix list is permit, the result will be to permit the default route

Hub(config)#router bgp 65001 .
Specifies a private BGP AS number for the local router
Hub(config-router)#network 0.0.0.0 mask 0.0.0.0
Tells BGP its allowed to advertise out the default route in its RIB-OUT
Hub(config-router)#neighbor 172.16.123.2 route-map SPOKE_ROUTERS out
Uses the route map previously created to control what is sent to the 172.16.123.2 neighbor
Hub(config-router)#neighbor 172.16.123.3 route-map SPOKE_ROUTERS out
Uses the route map previously created to control what is sent to the 172.16.123.3 neighbor
Avatar of jskfan

ASKER

Thanks Kevin

As I stated the configuration above would have made sense without this line:
Hub(config)#ip route 0.0.0.0 0.0.0.0 null0

if I understand the command above routes everything to bit bucket
That is required to ensure that the default route is present in the routing table. Without a route in the routing table, BGP will not advertise that it knows about a route to its peers.
Avatar of jskfan

ASKER

Hub(config)#ip route 0.0.0.0 0.0.0.0 null0

with null0, I thought any traffic coming out of the Hub will be discarded [put in a trash bin]
You are correct that null0 will discard traffic, but only the traffic that does not match on a more specific route will be discarded.

If you were to execute a show ip route on the device, I assume you will see several more specific routes, anything from /1 to /32 will be more specific than the default, learned by an interior routing protocol (OSPF, RIP, EIGRP).
Avatar of jskfan

ASKER

Thanks Kevin,

if we type it without the Null0
Hub(config)#ip route 0.0.0.0 0.0.0.0

will the default route still be advertised ?
ASKER CERTIFIED SOLUTION
Avatar of Kevin
Kevin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jskfan

ASKER

Thank you
You are very welcome!