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

why do I need to add a static route pointing to null 0

Hi,

I'm reading a bgp book.

it is said that in order to announce a route that doesn't exist in the forwarding table, a static route pointing to null 0 should be created !!!

but as I understand when a route is pointing to null 0, it mean that this trafic is going to be dropped. so I don't understand why should I created a static route that will drop the trafic, if a want to announce a route ??

thank you for your help

13 REPLIES
Cisco Employee

Re: why do I need to add a static route pointing to null 0

Hi Kay,

Many a times this route is used for routing loop prevention especially when some routing protocol is summarizing some routes.

Have a look at this link

http://www.cisco.com/en/US/tech/tk364/technologies_tech_note09186a00801c9a6e.shtml

Also look at this OSPF design guide and read the section "Inter-Area Route Summarization"

http://www.cisco.com/warp/public/104/1.html#t29

HTH

Ankur

*Pls rate helpfull post

Silver

Re: why do I need to add a static route pointing to null 0

When you're working with bgp sometimes you prefere to advertise a supernet instead of advertising several routes, so you create a route to null0 and if you receive a packet to one of the routes you route it, otherwise (there's no route) you discard it.

So the route to null0 it's a good way of route redistribution

At the next document, when it's talking about redistribution,you can see an example using null0 for this purpose

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

Regards

Hope this helps, if so pls rate post

Hall of Fame Super Gold

Re: why do I need to add a static route pointing to null 0

Kaine

In the situation that you describe creating a static route to null0 is not so much about loop prevention as it is about making sure that there is a route in the routing table so that BGP will advertise it.

When you configure a network statement under BGP to advertise a network, BGP looks in the routing table and if it finds an entry that matches the network statement then BGP advertises the route. If BGP does not find a matching entry in the routing table then BGP will not advertise the network, even though you have a network statement for it. So it may be that you want to advertise some prefix from your network and you have many subnets of that network in the table but that network is not in the routing table (or as Isabel suggests perhaps it is a supernet route) so you could configure a static route to be sure that the network is in the table.

Another aspect to consider is the difference between configuring a static route to an interface or configuring a static route to null0. If you configure a static route to an interface there is the possibility that there could be a problem with the interface and the static route would be withdrawn from the routing table. In this case BGP will withdraw the advertisement of the network. If you configure the static route to null0 then it will always be in the routing table and BGP will always advertise the network.

There is another aspect of this to consider. It may be that you would configure the static route to null0 even if the prefix does appear in the routing table. If you configure the BGP network statement and the prefix is in the routing table then BGP will advertise it. But what if something happens in your network and that network is no longer reachable. It will be withdrawn from your routing table. Then BGP will withdraw the advertisement. Some people believe that to enhance the stability of the Internet that it is good to continue to advertise a network, even if you can no longer forward to it (hopefully a temporary situation). So they configure static routes to null0 even for networks that do normally appear in the routing table.

HTH

Rick

New Member

Re: why do I need to add a static route pointing to null 0

Hi Rick,

So below config is to make the prefix 10.152.8.0/22 present in the bgp table even if the prefix goes down in ospf?  So this is more of making the network stable?

Another question why use a metric 190 in the static route? does that mean if OSPF goes down, there will still be a route going to the 10.152.8.0/22 network?

wan_router#
!
router bgp 65214
bgp router-id 10.152.11.241
bgp log-neighbor-changes
no bgp transport path-mtu-discovery
maximum-paths 4
no auto-summary
no synchronization
network 10.152.8.0 mask 255.255.252.0

###
#Usable Host Range:10.152.8.1 - 10.152.11.254
###

router ospf 65214
default-information originate metric 1 metric-type 1
redistribute bgp 65214 metric 1 metric-type 1 subnets route-map BGP-to-OSPF
router-id 10.152.11.241
passive-interface default
no passive-interface GigabitEthernet0/0

interface gig0/0
description --- P2P link to core_router Gi1/1/1 ---
ip address 10.152.11.193 255.255.255.252
ip ospf network point-to-point
ip ospf cost 50
duplex full
speed 1000
arp timeout 900
media-type rj45
no shutdown
snmp trap link-status
!
ip route 10.152.8.0 255.255.252.0 null0 190
!
end


core_router#
!
vlan 101
name data_vlan
!
interface Vlan101
description --- User Data VLAN 101 ---
ip address 10.152.8.1 255.255.255.128
!
vlan 201
name voice_vlan
!
interface Vlan201
description --- User Voice VLAN 201 ---
ip address 10.152.9.1 255.255.255.128
!
interface GigabitEthernet1/1/1
description --- Link to wan_router Gi0/0 ---
no switchport
ip address 10.152.11.194 255.255.255.252
ip ospf network point-to-point
ip ospf cost 50
speed 1000
duplex full
arp timeout 900
no shutdown
snmp trap link-status
logging event link-status
!
ip routing
!
router ospf 65214
router-id 10.152.11.243
ispf
log-adjacency-changes
nsf
passive-interface default
no passive-interface Port-channel1
no passive-interface gi1/0/48
no passive-interface gi 1/1/1
no passive-interface gi 1/1/3
network 10.152.11.243 0.0.0.0 area 0
network 10.152.11.192 0.0.0.3 area 0
network 10.152.11.196 0.0.0.3 area 0
network 10.152.11.208 0.0.0.3 area 0
network 10.152.8.0  0.0.0.127 area 0
network 10.152.9.0  0.0.0.127 area 0
network 10.152.11.212 0.0.0.3 area 0

Hall of Fame Super Gold

why do I need to add a static route pointing to null 0

It is a pretty old thread that you have adopted. But I will see what I can do to answer this new question.

Some parts of the answer are easy and I would like to do them first and then the parts that are not so easy.

Yes the static route of ip route 10.152.8.0 255.255.252.0 null0 190 is to make sure that the route is present in the routing table and therefore will be advertised by BGP.

Yes the 190 at the end of the static route makes this static route into a floating static and if some source suggests a route with a better administrative distance (such as OSPF) then the other route will be used in the routing table rather than the static route. So if OSPF does advertise 10.152.8.0/22 to the WAN router then the OSPF route will be in the route table and not the static to null 0.

Now the part that is not so easy. I do not see anything in what you have posted that shows that OSPF would advertise 10.152.8.0/22. I see that there are several subnets used in OSPF that are in that range of addresses. But I do not see anything that will result in advertisement of the summary. In that case I would say that the floating part of the static is not needed because I do not see where OSPF would advertise that summary route. (Is there more config that you have not posted that might do that?) And in that case I would say that the static route to null 0 is not so much for stability but is to make sure that the route is in the routing table so that BGP will advertise it.

HTH

Rick

New Member

Re: why do I need to add a static route pointing to null 0

Hi Rick,

Here are the complete interfaces.

wan_router#
!
router bgp 65214
bgp router-id 10.152.11.241
bgp log-neighbor-changes
no bgp transport path-mtu-discovery
maximum-paths 4
no auto-summary
no synchronization
network 10.152.8.0 mask 255.255.252.0

###
#Usable Host Range:10.152.8.1 - 10.152.11.254
###

router ospf 65214
default-information originate metric 1 metric-type 1
redistribute bgp 65214 metric 1 metric-type 1 subnets route-map BGP-to-OSPF
router-id 10.152.11.241
passive-interface default
no passive-interface GigabitEthernet0/0

interface gig0/0
description --- P2P link to core_router Gi1/1/1 ---
ip address 10.152.11.193 255.255.255.252
ip ospf network point-to-point
ip ospf cost 50
duplex full
speed 1000
arp timeout 900
media-type rj45
no shutdown
snmp trap link-status
!
ip route 10.152.8.0 255.255.252.0 null0 190
!
end


core_router#
!
Interface Loopback0
description Management Interface
ip address 10.152.11.243 255.255.255.255
!
vlan 101
name data_vlan
!
interface Vlan101
description --- User Data VLAN 101 ---
ip address 10.152.8.1 255.255.255.128
!
vlan 201
name voice_vlan
!
interface Vlan201
description --- User Voice VLAN 201 ---
ip address 10.152.9.1 255.255.255.128
!
interface GigabitEthernet1/1/1
description --- Link to wan_router Gi0/0 ---
no switchport
ip address 10.152.11.194 255.255.255.252
ip ospf network point-to-point
ip ospf cost 50
speed 1000
duplex full
arp timeout 900
no shutdown
snmp trap link-status
logging event link-status
!
interface GigabitEthernet1/1/3
description --- Link to wan2_router Gi0/0 ---
no switchport
ip address 10.152.11.198 255.255.255.252
ip ospf network point-to-point
ip ospf cost 50
speed 1000
duplex full
arp timeout 900
no shutdown
snmp trap link-status
logging event link-status
!
interface Port-channel1
description --- Link to core2_router PO1 ---
no switchport
ip address 10.152.11.209 255.255.255.252
ip ospf network point-to-point
ip ospf cost 30
arp timeout 900
!
interface GigabitEthernet 1/1/2
description --- Link to core2_router Gi1/1/2 ---
no ip address
no switchport
udld port aggressive
arp timeout 900
channel-group 1 mode on
no shutdown
snmp trap link-status
logging event link-status
!
interface GigabitEthernet 1/1/4
description --- Link to core2_router Gi1/1/4 ---
no ip address
no switchport
arp timeout 900
udld port aggressive
channel-group 1 mode on
no shutdown
snmp trap link-status
logging event link-status
!
ip routing
!
router ospf 65214
router-id 10.152.11.243
ispf
log-adjacency-changes
nsf
passive-interface default
no passive-interface Port-channel1
no passive-interface gi1/0/48
no passive-interface gi 1/1/1
no passive-interface gi 1/1/3
network 10.152.11.243 0.0.0.0 area 0
network 10.152.11.192 0.0.0.3 area 0
network 10.152.11.196 0.0.0.3 area 0
network 10.152.11.208 0.0.0.3 area 0
network 10.152.8.0  0.0.0.127 area 0
network 10.152.9.0  0.0.0.127 area 0
network 10.152.11.212 0.0.0.3 area 0

Hall of Fame Super Gold

why do I need to add a static route pointing to null 0

Thanks for the additional details. I still do not see anything that would show that OSPF would advertise the summary route. What do you see on the WAN router when you do show ip route?

HTH

Rick

New Member

why do I need to add a static route pointing to null 0

hi Rick,

here is the OSPF for the wan_router, sorry.

wan_router#

router ospf 65214

default-information originate metric 1 metric-type 1

redistribute bgp 65214 metric 1 metric-type 1 subnets route-map BGP-to-OSPF

router-id 10.152.11.241

passive-interface default

no passive-interface GigabitEthernet0/0

no passive-interface GigabitEthernet0/1

no passive-interface GigabitEthernet0/2

network 10.152.11.241 0.0.0.0 area 0

network 10.152.11.220 0.0.0.3 area 0

network 10.152.11.192 0.0.0.3 area 0

network 10.152.11.200 0.0.0.3 area 0

###

#so this means the network in bgp is now reachable since there is an IGP route going to it right? (core_router talks to wan_router via ospf)

###

Hall of Fame Super Gold

why do I need to add a static route pointing to null 0

What I suggested was to do show ip route and what you gave us was how OSPF is configured. Based on the configuration that you show I do not see anything that says that OSPF will advertise 10.152.8.0/22.

HTH

Rick 

New Member

why do I need to add a static route pointing to null 0

Hi Rick,

this config is for a new site, and I am trying to find out based on this config if indeed the new site can be reached by the remote wan_router or the HQ.

So you mean to say that the prefixes in OSPF cannot be seen on the routing table since there is no prefix for the summarized network?

will not the L3 p2p connection between core_router and wan_router propagate the ospf routes for the specific prefixes?

I am trying to find similar docs in cisco but all I can see are redistributing OSPF routes to BGP and in this case no redistribution were done...

Thanks again,

Rey

Hall of Fame Super Gold

why do I need to add a static route pointing to null 0

Rey

The question started out about a floating static route to null 0 and whether it would then be included in BGP. It seems that the question has now shifted to be about OSPF between some sites. I think it would be beneficial to reassess where we are and to clarify what question it is that we are trying to answer. So can you give me a clear statement of what the current question really is?

HTH

Rick

New Member

Re: why do I need to add a static route pointing to null 0

My question is that how can the LAN prefixes in OSPF be reachable on the remote wan_router even though there are no redistribution of OSPF to BGP in the configs I have sent...

So my assumption is this...

-the OSPF LAN prefixes are configured on the wan_router as summarized in bgp.

-the summarized prefixes are advertised via bgp using the network statement command.

-now in order for that summarized prefix to be in the routing table, a static route to null0 with AD of 190 is used as to be lower than any other dynamic or static routing protocol except IBGP.

-now that the summarized prefixes are in the routing table, the remote wan_router or the HQ can now reach that summarized prefix on the wan_router.

-and that wan_router has the specific prefixes defined in it's routing table via OSPF so it is still reachable.

So it means that same routing protocol needs to be used for adjacent devices HQ <-BGP---> wan_router <--OSPF--> core_router to exchange route information...

BUT the prefixes behind of that wan_router don't need to be the same routing protocol to be reachable, as long as it is in the routing table, no route redistribution necessary.

Is that right?

Hall of Fame Super Gold

Re: why do I need to add a static route pointing to null 0

Rey

There are aspects of your environment and network topology which we do not know and which might influence my answer. But based on what I understand so far here is my explanation of your questions. You have a WAN router and a core router. They are connected and run OSPF as the routing protocol to share routing information. Each of these routers has interfaces that are various subnets of 10.152.8 and each router advertises its subnets to its OSPF neighbor. So the various subnets of 10.152.8 are known to both routers. Your WAN router is also running BGP (and we do not know how many BGP neighbors or who they might be). Your WAN router wants to advertise the 10.152.8 addresses but does not want to advertise the individual subnets. So BGP has a network statement that will look for 10.152.8.0 255.255.252.0. That subnet does not naturally appear in the routing table from OSPF so there is a static route to null 0 for 10.152.8.0 255.255.252.0. This will allow BGP to advertise the summarized address.

Note that this static route is not for the benefit of the WAN or core router but is to enable advertising the summarized route to some other neighbor.

HTH

Rick

6547
Views
13
Helpful
13
Replies
CreatePlease to create content