2

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.

2 Answers 2

4

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

1
  • 1
    One particularly effective technique is to use the network 0.0.0.0 255.255.255.255 area <area> command to advertise the networks from all the router interfaces. Then you can use the passive-interface <interface> command to disable hellos on certain interfaces on which there are only end-devices. A variant is to use the passive-interface default command with the no passive-interface <interface> command for each interface where you expect a peer OSPF router. Some servers can run OSPF, and they default to Area 0, which can really mess up an OSPF network.
    – Ron Maupin
    Commented Oct 23, 2016 at 3:24
0

For OSPFv2 there is no interface command, the command you provided is a network command for OSFP.

OSPFv2 is pretty much configured the same way as RIPv2; however, OSPFv2 is a classless/link-state Routing Protocol which explain why you have to specify the Network and (Subnet mask or Wilcard) and Area, the network command will tell OSPF to send hello packets to all directly connected interface containing an IP address of that network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.