Forming OSPF neighbour relationships Open Shortest Path First

Practice this topic in the router emulator Before OSPF begins to learn about the various links and networks within the OSPF domain, it must first discover its neighbours with which to exchange this information. Using the hello protocol, it forms relationships with these neighbours by making some basic checks to ensure that its neighbour is suitable to form an adjacency with. This process is largely automatic and the administrator will have nothing to do with it other than perhaps to tweak some values should the neighbours deem each other to be unsuitable. The main part the network administrator has to play in this process is deciding which interfaces should be used to form these adjacencies.

The network command

Cisco decided to have OSPF (along with the other interior gateway protocols) use an unusual method of selecting interfaces on which to run the routing protocol. Although it is possible to select interfaces for this participation from interface configuration mode, Cisco prefers to select them from the routing protocol configuration mode using the network command.

Router(config-router)#network <ipAddress> <wildcardMask> area <areaId>

Lets break this command down into two parts: the IP address and wildcard mask element, and the area property.

IP address and wildcard mask

This part of the command defines a range of IP addresses. Any interface that has an address that falls into this range will be included in the OSPF process. Note that you should not treat this as a subnet as such, but a range. The IP address part can be any address that would be part of the subnet if the ipAddress and wilcardMask elements were treated as such. The wildcard mask is used in the same manner as the subnet mask. There is a short explanation of a wildcard mask on the standard ACLs learning page. So lets look at this with an example. Consider the IP addresses below and the interfaces that they have been assigned to, and the network command that was executed on the router.

Router(config-router)#network 192.168.0.0 0.0.3.255 area 0

+-------------+---------------+-----------+--------+
|      IP     |     Subnet    | Interface | Match? |
|   Address   |      Mask     |           |        |
+-------------+---------------+-----------+--------+
| 192.168.1.1 | 255.255.255.0 |   Fa0/0   |   YES  |
| 192.168.2.20| 255.255.255.0 |   Fa0/1   |   YES  |
| 172.168.1.5 | 255.255.255.0 |   Fa1/0   |   NO   |
+-------------+---------------+-----------+--------+

The network command has defined the range of addresses from 192.168.0.0 to 192.168.3.255. Any interface on the router with an address in that range will be a part of the OSPF process. Both of the first interfaces are a part of this process now, but the last is not as it is out of this range.

Area

The OSPF domain can be split up into areas to reduce the amount of OSPF traffic, and the number of calculations that OSPF must run to find a route to each network. This division of areas is carried out at the interface level, with each interface being a member of an area. Once again though, Cisco has decided to use the unusual method of doing this from router configuration mode with the network command. Once again, using an example is best to explain this.

Router(config-router)#network 192.168.0.0 0.0.0.255 area 0
Router(config-router)#network 192.168.2.0 0.0.1.255 area 10
Router(config-router)#network 192.168.8.0 0.0.3.255 area 20

+-------------+---------------+-----------+--------+
|      IP     |     Subnet    | Interface |  Area  |
|   Address   |      Mask     |           |        |
+-------------+---------------+-----------+--------+
| 192.168.0.1 | 255.255.255.0 |   Fa0/0   |    0   |
| 192.168.2.20| 255.255.255.0 |   Fa0/1   |    10  |
| 192.168.3.5 | 255.255.255.0 |   Fa1/0   |    10  |
| 192.168.8.5 | 255.255.255.0 |   Fa1/1   |    20  |
| 192.168.50.1| 255.255.255.0 |   Fa2/0   |   N/A  | (not matched with network)
+-------------+---------------+-----------+--------+

Comments