cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3618
Views
10
Helpful
9
Replies

How does OSPF advertise networks when only OSPF interface is set?

jacobholmjensen
Level 1
Level 1

Hi all,

I'm having some issues understanding the OSPF protocol and how it advertises networks.

 

Let's say I enable OSPF on interface g0/0 with "ip ospf 1 area 0" command. What does this command do exactly, and how does it start advertising networks from the routers routing-table??

 

My ideas so far is:

1) It enables OSPF on that specific interface, and will start to advertise its known networks.

2) It enables OSPF on that specific interface, and will start to advertise the 10.0.0.0/8 network.

 

Is the above command considered "enough" to start the advertising of known networks, or do I still have to do the following to start advertising the 10.0.0.0/8 network?

Device# conf t
Device#(config) router ospf 1
Device#(router-config) network 10.0.0.0 0.255.255.255 area 0

I've tried searching for similar issues/misunderstandings, but I can't find specific answers.

 

Thank you very much.

Jacob.

9 Replies 9

...

Jon Marshall
Hall of Fame
Hall of Fame

 

It will start OSPF running on that interface and the router will then discover any OSPF neighbors reachable from that interface and if there are any form adjacencies and exchange LSAs which are used to populate the OSPF database and build the routing table. 

 

You would not need the network entry under your router ospf configuration. 

 

Jon

Hello,

 

in addition to @Jon Marshall enabling on the interface only advertises that network configured for that interface to its neighbors. So if you interface IP was in a 10.0.0.0/8 network that’s what it will advertise. Whatever the interface is configured for. It will NOT, as you say “advertise” routes from the routing table. It populates the routing table (if it has the best metric or more specific route) You would need the command on either every interface you want to advertise a network for or under the ospf process or you can use interface or network commands. Keep in mind the network commands do not advertise the network but rather includes the interface that network statement covers. 

So if your network statement was:

network 10.0.0.0 0.255.255.255 area 0

that would Include all interfaces with a 10.anything IP. Also note it uses a wildcard which is usually the opposite of a subnet mask and denotes a range of Interfaces to include.

 

The I terrace command does the same thing but It just advertises that network specifically. It gives you more granular control. Interface commands take precedence over global commands.

 

Hope that helps

 

-David

Hi David,

Thank you very much for your explanation - it really helped cleaning up some misunderstanding.

 

Just for my own education, what I'm understanding from your answer is:

1) I can choose to use OSPF with a network command where all interfaces with IP's in that network will be OSPF enabled (fx. 10.0.0.0/8). The interfaces will then start sending Hello packets to look for neighbors - and if an adjacency is build, they will start to exchange LSDB to synchronize. By using the network command I'm saying to ALL interfaces with an IP in the 10.0.0.0/8 network that they are OSPF enabled - if one of those are connected to a LAN, that's when I would be using passive-interface. A passive-interface is only a "member" of the OSPF area but will not be sending Hello packets, but its network would be shared via OSPF LSDBs?

 

2) I can choose to use OSPF per interface, where OSPF would be advertising the interfaces network? Fx. if the interface is 10.0.0.1/30, then the 10.0.0.0/30 network would be advertised in the OSPF area it belongs to?

 

However, I can also use the network command like this: "network 10.0.0.1 0.0.0.3 area 0" to advertise the 10.0.0.0/30 network in the OSPF area?

 

What, I think, I'm still missing is why you would have both options available to reach the same end goal? I can't, for the life of me, figure out why one is better (or considered "better practice) that the other?

 

Again, thank you very, very much for your answer. And that goes to Jon Marshall and MHM aswell

Correct….and  @MHM Cisco World just provided a great explanation as to why use one over the other above (I think it shows above this response). It’s basically you have more granular control with the interface commands to advertise just that network. If you use a network command with a range of addresses and later add an Interface that falls within that range it will start advertising it Into ospf even if you don’t want it to and you have to go back and change the network command disrupting the network possibly. That on top of remembering if adding an interface ip will advertise into ospf especially in large networks.

 

Final note:

your statement of

 

However, I can also use the network command like this: "network 10.0.0.1 0.0.0.3 area 0" to advertise the 10.0.0.0/30 network in the OSPF area?

 

Only if you have an interface with 10.0.0.0/30 configured and up. Also I think it would be 10.0.0.0 0.0.0.3 which includes the 10.0.0.1 and 10.0.0.2 interface address. 

 

-David

""

OSPF is enabled on an interface when the network address for the interface matches the range of addresses that is specified by the network area command, which is entered in router configuration mode. Alternatively, you can enable OSPFv2 explicitly on an interface by using the ip ospf area command, which is entered in interface configuration mode. This capability simplifies the configuration of unnumbered interfaces with different areas.

Because the ip ospf area command is configured explicitly for an interface, it supersedes the effects of the network area command, which is entered at the network level to affect the interfaces whose addresses fall within the address range specified for the network area command.

If you later disable the ip ospf area command, the interface still will run OSPFv2 as long as its network address matches the range of addresses that is specified by the network area command.""

After the somewhat dumbed-down explanation this makes complete sense. I've made sure to bookmark the Cisco Content Hub you referenced

 

Thank you very much for all your help, MHM - and thank you for highlightning the specific part. I must admit that I did not think about what it meant in regards to OSPF on an interface-level.

Your Are so so welcome friend.

Hello


@jacobholmjensen wrote:

 

1) It enables OSPF on that specific interface, and will start to advertise its known networks.

Correct and it also enables ospf hellos to be transmitted so the interface can try to establish an ospf peering, this can be negated by putting the interface into a passive mode, either via the interface itself or via the ospf routing process stanza.

Lastly older routing IOS, you could ONLY enable OSPF on an interface via the ospf routing process stanza, but nowadays its mostly all interface specific.

 

int x/x
ip address x.x.x.x.
ip ospf x area X
ip ospf passive
ip ospf network xxx

older IOS
router ospf 1

passive interface xxx
network x.x.x.x y.y.y.y area x


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul
Review Cisco Networking products for a $25 gift card