04-12-2012 05:58 PM - edited 03-07-2019 06:06 AM
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
Solved! Go to Solution.
04-12-2012 06:06 PM
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
04-12-2012 06:07 PM
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
04-12-2012 07:46 PM
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.
04-12-2012 06:06 PM
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
04-12-2012 06:07 PM
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
04-12-2012 06:11 PM
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
04-12-2012 07:46 PM
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.
04-12-2012 08:00 PM
Hi all,
Many thanks to all of you for helping me understand the BGP command.
Regards
MAhesh
07-15-2019 10:44 PM - edited 07-16-2019 09:14 PM
Me too facing the same issue,
However, its been solved.I want to advertise network==>64.128.160.80/28 through BGP,
[NOTE:64.128.160.80/28 is used as IP POOL for DNAT]
Its accomplished by any one of below 2 methods:-
1) By means of NULL route creation:-
ip route 64.128.160.80 255.255.255.240 Null0
or
2) By means of Loopback interface creation:-
Just by creating a loopback interface with IP==> 64.128.160.94/28 on the BGP edge router (RTB in pic.)
"interface Loopback0
ip address 64.128.160.94 255.255.255.240"
&
Advertising==>64.128.160.80/28 by BGP on RTB router
"router bgp 200
bgp log-neighbor-changes
no synchronization
neighbor 10.1.1.2 remote-as 100
network 64.128.160.80 mask 255.255.255.240"
Any of these 2 configuration creates BGP route in the routing tables of both RTA & RTB:
RTB routing table:==
"Gateway of last resort is 10.1.1.2 to network 0.0.0.0
R 1.0.0.0/8 [120/1] via 172.16.1.2, 00:00:01, Serial2/0
2.0.0.0/30 is subnetted, 1 subnets
C 2.1.1.0 is directly connected, Serial3/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial6/0
B 32.0.0.0/8 [20/0] via 10.1.1.2, 00:10:41
64.0.0.0/28 is subnetted, 1 subnets
C 64.128.160.80 is directly connected, Loopback0
172.16.0.0/30 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, Serial2/0
R 192.168.1.0/24 [120/1] via 2.1.1.2, 00:00:06, Serial3/0
S* 0.0.0.0/0 [1/0] via 10.1.1.2"
RTA routing table:=
"Gateway of last resort is not set
10.0.0.0/30 is subnetted, 1 subnetsBGP-Topology
C 10.1.1.0 is directly connected, Serial2/0
C 32.0.0.0/8 is directly connected, FastEthernet0/0
64.0.0.0/28 is subnetted, 1 subnets
B 64.128.160.80 [20/0] via 10.1.1.1, 00:11:30"
NOTE:==ANY ONE METHOD COULD BE USED, JUST TO HIGHLIGHT THE INTENDED NETWORK IN THE ROUTING TABLE
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide