OSPF
Open Shortest Path First (OSPF) is a link state routing protocol. A link state protocol, as its name implies, intends to find the best and shortest route possible by using the Dijkstra algorithm "shortest path first." This algorithm computes the best route between the source node and the other nodes. It separates the the nodes into two sets, the evaluated nodes and the remaining nodes. Also, it keeps a list of paths. The algorithm uses a series of metrics to establish the best path. These metrics must be the same in all the routers. One important feature of this protocol is that every router maintains a complete description of the network in the routing table. In other words, every router knows every route.
In this manual we will work with the same design we did for the RIP manual but we will implement OSPF in multiple areas. First we need to create an OSPF routing process, specify a range of IP addresses, assign area IDs and router IDs. We will define a loopback 0 for each router and that IP will become the router ID.
To enable OSPF in a Cisco router, we write the command
router ospf [process id]
network [address] [wildcard mask] area [area ID]
The wildcard mask is not the subnet mask but the mask used in access lists.
| Subnet mask | wildcard mask octet | 255 | 0 |
|---|---|
| 254 | 1 |
| 252 | 3 |
| 248 | 7 |
| 240 | 15 |
| 224 | 31 |
| 192 | 63 |
| 128 | 127 |
| 0 | 255 |
To apply cost , we use the ip ospf cost [cost] command. Otherwise, the cost is calculated by default by dividing 10*8/bandwidth in bps.
Example:
router ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 1.1.1.1 0.0.0.0 area 2
network 10.2.12.1 0.0.0.0 area 2
network 10.2.13.1 0.0.0.0 area 2