OSPF Configuration – Understanding Directly Connected Networks

ciscoospfriprouting

This is a question I've seen mixed answers for online, so I'll try to clearly explain what I'm having trouble understanding. With RIP, you have your router and you explicitly tell it your directly connected networks like such:

network [network address of the network linking the two routers]

However, from what I understand, OSPF does not do this. Instead, you configure your interfaces for OSPF like such:

network [address of Serial 0 (for example)] [wildcard address] area [X]

My question therefore is: If you're configuring interfaces rather than networks, how does OSPF come to understand the network between two routers?


I do have a theory as to why, but I'm not sure. I'm thinking that because your Serial 0 (for example) and another routers Serial 1 (for example) will have the same subnet mask, the wildcard address tells OSPF that these are on the same network. I'm not sure if this is correct, but I'd love some clarification on this if possible.

Best Answer

In OSPF the network statement is used to configure which interface will participate in the OSPF process (I.E on which interface to send and listen for Hello packets)

This is done by comparing the value of the network statements (in ospf configuration) versus the network configured on all of the routers interface.

The network configured in ospf doesn't have to be an exact match to the network configured on the interface. The latter can be a subnet.

For example:

  • interface 1 : 10.0.0.254/24
  • interface 2 : 10.0.1.254.24
  • inteface 3 : 10.0.2.254/24
  • ospf : network 10.0.0.0/23

With this configuration, interface 1 & 2 will participate in OSPF process, and not interface 3. This is because 10.0.0.0/24 and 10.0.1.0/24 are subnets of 10.0.0.0/23.

If later I want to add interface 3 in OSPF I can either add a second network statement...

  • ospf : network 10.0.0.0/23
  • ospf : network 10.0.2.0/24

...or enlarge the first one :

  • ospf : network 10.0.0.0/22

(You can also use a very large mask in the ospf configuration and exclude some interfaces manually)

So OSPF will send HELLO packets on all interfaces with IP addresses that match the OSPF network statements, it will also respond to HELLO packets received on those interfaces. It will ignore HELLO packets on other interfaces.

In the same time the OSPF network is used to configure the area in which the interface will be.

So if you want all 3 interfaces to be in area 0 you will use :

  • ospf : network 10.0.0.0/22 area 0

If you want to have interface 1 & 2 in area 0 and interface 3 in area 1 you have :

  • ospf : network 10.0.0.0/23 area 0

  • ospf : network 10.0.2.0/24 area 1

Related Topic