Basic OSPF (or any routing protocol) Net advertisement query

Unanswered Question
Sep 19th, 2008
User Badges:

Hi All,

This is a simple basic question, I would like to get n/w gurus oenions..


Say a router with config..


*****************************

router ospf 100

network 10.40.0.0 0.0.255.255 area 0.0.0.0

network 10.40.100.0 0.0.0.255 area 0.0.0.0

*****************************


What is advantage(s) of having seperate 'network' statement for 10.40.100.0/24 subnet.



Thank you in advance.

MS



  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 3.7 (6 ratings)
Loading.
Jon Marshall Fri, 09/19/2008 - 06:50
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

MS


The network statement under ospf tells the router which interfaces to start an OSPF process on. So imagine a router with 2 interfaces


int fa0/0

ip address 10.40.20.1 255.255.255.0


int fa0/1

ip address 10.40.100.1 255.255.255.0


With the network 10.40.100.0 0.0.0.255 statement the router will only run OSPF on int fa0/1 and will form adjacencies on that subnet.


With the network 10.40.0.0 0.0.255.255 statement the router will run OSPF on both interfaces and form adjacencies on both subnets.


So you choose the relevant network statement depending on which interfaces you want to run OSPF on.


Edit - just noticed the title as in (or any routing protocol). The "network" statement under BGP behaves differently than the way i have explained it above. Under BGP the network statement does indeed tell the router which network to advertise to it's peers.


Jon

John Blakley Fri, 09/19/2008 - 07:03
User Badges:
  • Purple, 4500 points or more

From my understanding, OSPF runs in order, so if you didn't apply this to a specific interface for routes, your second line wouldn't do anything because it's covered by the first.


--John

Jon Marshall Fri, 09/19/2008 - 07:08
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

John


I think i mis-interpreted the question. I was assuming that MS was asking what difference it would make between using either one or the other under the OSPF config not using both. I was trying to get across that the network statement under OSPF does not tell the router which networks to advertise.


I think you interpreted correctly.


Jon

John Blakley Fri, 09/19/2008 - 07:12
User Badges:
  • Purple, 4500 points or more

Thanks Jon.


MS,


Also, if you want to tighten down your routes, then change your first line to:


10.40.0.0 0.0.0.255


Then your second line can stay the same, and you'll only be advertising your 10.40.0.X and 10.40.100.X and nothing in between.



--John

Joseph W. Doherty Fri, 09/19/2008 - 09:39
User Badges:
  • Super Bronze, 10000 points or more

As Jon notes in his response, OSPF is somewhat different from other protocols. Its network statement is used to match interfaces that should be included. The subnet portion of the network statement doesn't have anything to do with the subnet actually on the interface, it's used just to match whether the interface IP matches (similar concept to matching IP addresses within an ACL).


Perhaps the "safest" method to match is use host like OSPF network statements. This insures only the interfaces you explicitly have network statements for are used in OSPF (including the correct OSPF area).


Larger "wild card" OSPF network statements, avoid the configuration of one network statement per interface, but also make it easier to have an interface incorrectly included within OSPF. Also like ACLs, and mentioned by another poster, OSPF network statements are sequence dependent, so improperly sequenced "wild card" network statements can cause issues.

fortis123 Fri, 09/19/2008 - 10:37
User Badges:

Thank you all for valuable responses. From the statement below...


"Perhaps the "safest" method to match is use host like OSPF network statements. This insures only the interfaces you explicitly have network statements for are used in OSPF (including the correct OSPF area). "


on a L3 switch, if I have a Vla25 with 40 ports/hosts set for Vlan25 and 10.40.25.1 acting as gateway (int vla25), For all the hosts to advertised via OSPF does the statement


network 10.40.25.1 0.0.0.0 area 0.0.0.0


rather than


network 10.40.25.0 0.0.0.255 area 0.0.0.0


works..??


Thank you

MS



Jon Marshall Fri, 09/19/2008 - 15:13
User Badges:
  • Super Blue, 32500 points or more
  • Hall of Fame,

    Founding Member

  • Cisco Designated VIP,

    2017 LAN, WAN

MS


The key is to understand that the "network" statement only tells the router which interfaces to run OSPF on.


So "network 10.40.25.1 0.0.0.0 area 0.0.0.0" tells the router if it has an interface with the exact address of 10.40.25.1 to run OSPF on that interface. It doesn't matter to the router how many hosts are in that vlan. But it will send information to any peers on that interface about the the vlan 25 subnet ie. 10.40.25.0 and the subnet mask eg. 255.255.255.0


What Joseph was trying to get across was - lets say you have 3 ethernet interfaces on the router


fa0/1

ip address 192.168.1.1 255.255.255.252


fa0/2

ip address 192.168.1.5 255.255.255.252


fa0/3

ip address 192.168.1.9 255.255.255.252


network 192.168.1.0 0.0.0.255 = 192.168.1.1 - 192.168.1.254


will match all the above interfaces and the router will start OSPF on all interfaces.


network 192.168.1.0 0.0.0.7 = 192.168.1.1 - 192.168.1.7


will match int fa0/1 and int fa0/2 and the router will start OSPF on those 2 interfaces.


So lets say you just wanted OSPF started on int fa0/1. Easiest and simplest way to do this is just use the host address, that way you are sure you are only starting OSPF on that interface ie.


network 192.168.1.1 0.0.0.0 area 0.0.0.0


Does this make sense ?


Jon

Joseph W. Doherty Fri, 09/19/2008 - 16:05
User Badges:
  • Super Bronze, 10000 points or more

Either should pull the interface into OSPF for area zero. However if your gateway was 10.40.25.2, "network 10.40.25.1 0.0.0.0 area 0.0.0.0" wouldn't match the IP address of the interface but "network 10.40.25.0 0.0.0.255 area 0.0.0.0" still would.


Jon's follow on post shows more. Again though, once OSPF selects the interface, it obtains the network by looking at the interface's IP address mask, not the network statement mask. So, for instance, "network 10.40.25.1 0.0.0.0 area 0.0.0.0" would match the interfaces with addresses such as:

ip address 10.40.25.1 255.0.0.0

ip address 10.40.25.1 255.255.0.0

ip address 10.40.25.1 255.240.0.0

ip address 10.40.25.1 255.255.240.0

ip address 10.40.25.1 255.255.255.0

ip address 10.40.25.1 255.255.255.240

etc.

fortis123 Fri, 09/19/2008 - 19:54
User Badges:

Great explanations. Thank you all...Last question...


Can I have multiple devices acting as ASBR and are connecting to same OSPF area?


Thank you

MS


Joseph W. Doherty Sat, 09/20/2008 - 01:53
User Badges:
  • Super Bronze, 10000 points or more

Yes you can. Or they can be within different areas or both.

Actions

This Discussion