Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Webcast-Catalyst9k
New Member

Purpoese of ip route x.x.x.x null 0 BGP command

hi all,

I was working on home BGP lab.

R1 is advertising network 172.16.0.0 mask 255.255.255.0  to EBGP  router R4.

172.16.1.1 is loopback IP of R1.

R4 is not receiving route 172.16.0.0.

But when i use command

ip route 172.16.0.0 255.255.255.0 null0 on R1 then R4 can see the 172.16 route.

Can someone please expalin me why we use ip route null0 command and how it advertise the 172.16 network?

Thanks

MAhesh

3 ACCEPTED SOLUTIONS

Accepted Solutions
VIP Super Bronze

Purpoese of ip route x.x.x.x null 0 BGP command

Hi Mahesh,

The route has to present in your routing table before BGP can advertise it to the peer.  In this case

172.16.0.0 in not in your routing table until you point it to  null0 interface.

Also, have a look at this doc deplaning the same exact problem:

Because there is no component route (no classful  route or subnet route ) in the R101 IP routing table, the network  6.0.0.0 in not installed in the BGP table. The minimum requirement for a  prefix configured under the

network

command to be installed in a  BGP table is to have a component route in the IP routing table. So make  sure that R101 has a component route for network 6.0.0.0/8 either by  learning it through IGP or through static configuration. In the example  shown, the static route is configured to null 0.

Here is the link:

http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a00800945ff.shtml

HTH

Cisco Employee

Purpoese of ip route x.x.x.x null 0 BGP command

I guess you have loopback on R1 configured with mask /32. and advertising route to R4 using network command in BGP> BGP can only advertise routes through this command which it has in Global Routing Table. Thus without NULL0 route you had only /32 subnet in GRT and BGP network dod not work.

Creating Null0 route to /24 subnet created static route in GRT for /24 network and BGP started to advertise it. I guess changing mask on loopback interface to /24 can also do same and let you not to use Null0 static.

Nik

Re: Purpoese of ip route x.x.x.x null 0 BGP command

Hi Mahesh,

Network statement should exactly match the route in IP route table so that it gets advertised into BGP.

In you case you said you had a network statement "network 172.16.0.0 mask 255.255.255.0" since you had loopback with ip add 172.16.1.1/24 .

If you observe the third octet 0 vs 1 . they are different networks. So when you put a null route to network 172.16.0.0/24 your network got adverised as it matched the "network mask" statement.

*Always remember the "network mask" statement should match the route exactly as in igp route table with the mask if you want it to get advertised in bgp.

So it has nothing to do with static route to null 0 , its just about exact match .

Let me know if this helped.

5 REPLIES
VIP Super Bronze

Purpoese of ip route x.x.x.x null 0 BGP command

Hi Mahesh,

The route has to present in your routing table before BGP can advertise it to the peer.  In this case

172.16.0.0 in not in your routing table until you point it to  null0 interface.

Also, have a look at this doc deplaning the same exact problem:

Because there is no component route (no classful  route or subnet route ) in the R101 IP routing table, the network  6.0.0.0 in not installed in the BGP table. The minimum requirement for a  prefix configured under the

network

command to be installed in a  BGP table is to have a component route in the IP routing table. So make  sure that R101 has a component route for network 6.0.0.0/8 either by  learning it through IGP or through static configuration. In the example  shown, the static route is configured to null 0.

Here is the link:

http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a00800945ff.shtml

HTH

Cisco Employee

Purpoese of ip route x.x.x.x null 0 BGP command

I guess you have loopback on R1 configured with mask /32. and advertising route to R4 using network command in BGP> BGP can only advertise routes through this command which it has in Global Routing Table. Thus without NULL0 route you had only /32 subnet in GRT and BGP network dod not work.

Creating Null0 route to /24 subnet created static route in GRT for /24 network and BGP started to advertise it. I guess changing mask on loopback interface to /24 can also do same and let you not to use Null0 static.

Nik

New Member

Purpoese of ip route x.x.x.x null 0 BGP command

Hi Nik,

I was using the mask /24 on loopback on R1.

Still it did not work without ip route command null0 do you why?

Thanks

MAhesh

Re: Purpoese of ip route x.x.x.x null 0 BGP command

Hi Mahesh,

Network statement should exactly match the route in IP route table so that it gets advertised into BGP.

In you case you said you had a network statement "network 172.16.0.0 mask 255.255.255.0" since you had loopback with ip add 172.16.1.1/24 .

If you observe the third octet 0 vs 1 . they are different networks. So when you put a null route to network 172.16.0.0/24 your network got adverised as it matched the "network mask" statement.

*Always remember the "network mask" statement should match the route exactly as in igp route table with the mask if you want it to get advertised in bgp.

So it has nothing to do with static route to null 0 , its just about exact match .

Let me know if this helped.

New Member

Purpoese of ip route x.x.x.x null 0 BGP command

Hi all,

Many thanks  to all of you  for helping me understand the BGP command.

Regards

MAhesh

13321
Views
0
Helpful
5
Replies
CreatePlease to create content