OSPF vs static routing

Answered Question
Mar 4th, 2008
User Badges:

hi, I have the following config on one of my routers:


router ospf 50

log-adjacency-changes

network 172.26.64.0 0.0.0.255 area 0.0.0.0

network 172.26.65.0 0.0.0.255 area 0.0.0.0

!

ip classless

ip route 0.0.0.0 0.0.0.0 172.26.64.69


Since static routing has lower AD than OSPF, I think the routing table would only have static route. but I can also see route learned from OSPF on this router. anybody knows why?

ip route 0.0.0.0 0.0.0.0 172.26.64.69 is a default route

If a packet enter from any interface of the router with a destination address which cannot find in routing table. The router use the default route for this packet.


yes static route has lower AD than OSPF.

However router use AD for tie break only when route with same network address and netmask.


for example:

1) 192.168.1.0 255.255.255.0 192.168.2.1 this route learn from OSPF

192.168.1.0 255.255.255.0 192.168.2.2 this route

is a static route

the result is that the router will use the static route instead of OSPF route


2) 192.168.1.0 255.255.255.128 192.168.2.1 this route learn from OSPF

192.168.1.0 255.255.255.0 192.168.2.2 this route

is a static route

the result is that the router will use the OSPF route instead of static route because the OSPF route is more specific


  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (2 ratings)
Loading.
lamav Tue, 03/04/2008 - 17:03
User Badges:
  • Blue, 1500 points or more

Wayne:


This is how it works...


If a router receives multiple routing updates about a particular network from the same routing protocol, it will choose the route with the lowest "cost" (metric). If the routing protocol supports equal cost routes and the multiple routes all have the same metric, it will then place those equal cost routes in the routing table.


If a router receives routing updates about a particular network from different routing protocols (or a routing protocol and a static route), it will choose the route with the lowest Administrative Distance.


IMPORTANT: In both cases, though, the updates for the network in question have the same prefix length. In other words, comparable routes are compared.


For example, route 10.10.0.0 255.255.0.0 learned from OSPF and 10.10.0.0 255.255.0.0 from EIGRP ARE comparable. However, 10.0.0.0 255.0.0.0 from OSPF and 10.10.10.0 255.255.255.0 from EIGRP are NOT comparable routes.


So, if your router has learned about a network via OSPF and no other routing protocol is advertising that network, and there is no comparable static route, then that OSPF route will be placed in the routing table.


HTH


If so, please rate this post.


Victor

devang_etcom Tue, 03/04/2008 - 18:26
User Badges:
  • Gold, 750 points or more

Hi,


here in your case you have multiple routing information source is going on as you have ospf and the Static route so you will have the best path in your routing table for the same network but from different source of the routing protocol as each protocol has their own calculation to find out the best path so route to network 1.a.b.c via 2.a.b.c is best path for ospf but for RIP best path to 1.a.b.c is via 3.a.b.c so here both the routing have their own way to select the best path so they will have their best path in routing table but as both has different AD so router will select the routing information of the path has lowest AD...

Correct Answer

ip route 0.0.0.0 0.0.0.0 172.26.64.69 is a default route

If a packet enter from any interface of the router with a destination address which cannot find in routing table. The router use the default route for this packet.


yes static route has lower AD than OSPF.

However router use AD for tie break only when route with same network address and netmask.


for example:

1) 192.168.1.0 255.255.255.0 192.168.2.1 this route learn from OSPF

192.168.1.0 255.255.255.0 192.168.2.2 this route

is a static route

the result is that the router will use the static route instead of OSPF route


2) 192.168.1.0 255.255.255.128 192.168.2.1 this route learn from OSPF

192.168.1.0 255.255.255.0 192.168.2.2 this route

is a static route

the result is that the router will use the OSPF route instead of static route because the OSPF route is more specific


devang_etcom Tue, 03/04/2008 - 21:57
User Badges:
  • Gold, 750 points or more

yes... router will give the preference to more specific mask or longest prefixes no mater from which routing source it learned from...

Actions

This Discussion