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

Basic OSPF (or any routing protocol) Net advertisement query

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

10 REPLIES
Hall of Fame Super Blue

Re: Basic OSPF (or any routing protocol) Net advertisement query

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

Re: Basic OSPF (or any routing protocol) Net advertisement query

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

HTH, John *** Please rate all useful posts ***
Hall of Fame Super Blue

Re: Basic OSPF (or any routing protocol) Net advertisement query

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

Re: Basic OSPF (or any routing protocol) Net advertisement query

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

HTH, John *** Please rate all useful posts ***
Super Bronze

Re: Basic OSPF (or any routing protocol) Net advertisement query

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.

New Member

Re: Basic OSPF (or any routing protocol) Net advertisement query

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

Hall of Fame Super Blue

Re: Basic OSPF (or any routing protocol) Net advertisement query

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

Super Bronze

Re: Basic OSPF (or any routing protocol) Net advertisement query

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.

New Member

Re: Basic OSPF (or any routing protocol) Net advertisement query

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

Super Bronze

Re: Basic OSPF (or any routing protocol) Net advertisement query

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

249
Views
22
Helpful
10
Replies
CreatePlease to create content