OSPF (Open Shortest Path First) is one of the routing protocol most used. It's a link state routing protocol.

OSPF use bandwidth as its metric. The algorithm it uses to calculate the metric is to divide 100,000,000 by the bandwidth that the link has in bps, so a 100 Mbps link will have a metric value of 1.

OSPF forces you to design the network by dividing it into areas, there are two main type of area backbone area (usually called area 0) and nonbackbone area. OSPF also support different type of network in fact that there are different type of networks like point to point, broadcast (ehternet, Token Ring, FDDI), nonbroadcast (framerelay), etc..

there are also different kind of routers in OSPF. Designated Router is the router that do the brunt of the OSPF processing. DR and Backup DR is elected in every area (in every area - not so sure about this) through a complicated way (ospf priority, highest loopback ip, highest ip address assigned to this router)

usually a router running OSPF has a loopback interface to prevent the election of the DR through the highest physical ip address.

OSPF routers don't send routes instead they send link state advertisement (LSA). there are different kinds of LSA. Router LSA is sent by every OSPF router, Network LSA is sent by DR, and etc...

so, when you're configuring a network with OSPF (remember that OSPF is a classless routing protocol) you specify which area this network will be in.
network area 0

the complexity of OSPF is one of the reasons that many people choose EIGRP instead. but remember that EIGRP is only implemented by cisco routers.

routes redistributed into OSPF is divided into two 2 types. E1 routes increase the metric of the route as it is propagated through OSPF router (added cost at each hop). while E2 routes have its metric the same for all routers.

Routes from different AS is a E2 route.

routes summarization
enter the following command in ABR router (Area Border). to announce the summary route to other OSPF areas
area xxx range A.B.C.D yyy.yyy.yyy.yyy

xxx : area of the summary route
A.B.C.D : ip address of the summary
yyy.yyy.yyy.yyy : subnet mask of the summary

for example an OSPF area 4 has the following subnet
in this example the summary address is . then enter the following command to the ABR router of thearea
area 4 range

enter the following command to the ABR
summary-address A.B.C.D yyy.yyy.yyy.yyy

A.B.C.D : ip address of the summary
yyy.yyy.yyy.yyy : subnet mask of the summary

OSPF doesn't support IPX

OSPF default values
Hello time - 10 (multiaccess and point-to-point), 30 on NBMA
Dead time - 40 (dead time is the time for OSPF to wait before declaring the end router is down).

in order for two router establishing an adjacency, both router must have the same timers value and network type. those parameter is
-hello interval
-dead interval
-network type

five network types in OSPF:
- point-to-point
- broadcast multiaccess
- nonbroadcast multiaccess (NBMA)
- point-to-multipoint
- virtual links

OSPF multicast address: = all ospf routers = all DR routers


five types of OSPF LSPs(Link State Packets)
1.Hello - used to maintain adjacency with other OSPF routers.
2.DBD - Database Description, sent to other OSPF routers that contains an abbreviated list of the sending router's link-state database and used by the receiving routers to check against the local link-state database.
3.LSR - Link State Request, sent to request more information about any entry in the DBD.
4.LSU - Link State Update, used to reply LSR and to announce new information.
5.LSAck - Acknowledgement to LSU.

OSPF calculates the metric using the bandwidth of the link. the calculation is taken as per 100mbps, so if a link bandwidth is 100mbps then the cost is 1. you can change the reference-bandwidth the ospf command "auto-cost reference-bandwidth" (measured in mbps). it's good practice to change the reference-bandwidth on all router running ospf when you change it on a router.

ALTERNATIVELY, you can set a cost for an interface in OSPF without OSPF needing to calculate the cost anymore by entering the following command at interface level configuration:
ip ospf cost xxx

xxx : the number of the cost


DR and BDR election is happen only in multiaccess network.

election of DR & BDR happen as soon as an interface of a router participate in OSPF routing. this can happen when a router boot up or a network command for an interface is enabled. because of this, a router with a lower ip address (or routerID) could be the DR if it happened to be the first router running OSPF that boots. once a router become a DR, it will be a DR until it fails, or interface shutdown.

election process:
1. DR: router with the highest OSPF interface priority.
2. BDR: router with the second highest OSPF interface priority
3. if OSPF interface priorities are equal, the highest router'ID is used to break the tie.

Determining router ID
1. use the IP address configured with the "router-id" command.
2. use the highest loopback interface address.
3. use the ACTIVE (interface must be in an up-up state, but not neccessarily included in OSPF activity) physical IP address.

YOU CAN CHANGE THE VALUE OF OSPF INTERFACE PRIORITY by entering the following command at interface level configuration
ip ospf priority (0-255)
because OSPF interface priority is set on interface level. it can be set that a router be the DR on a network and a DRother on another network.

every link on an OSPF has a state. this state tell us about it's status with the other end device.

"show ip ospf neighbor" can show you about neighbor OSPF routers, their status as DR/BDR/DRother and their state with the local router (2WAY / FULL). 2WAY is adjacency between DRother routers they don't send LSA to each other just hello packets, FULL is adjacency between DROther and DR.

router ospf process-id is a number between 1-65535. the process-id is only locally significant, means that it may differ between router running OSPF to establish an adjacency. this is different with EIGRP that the autonomous-number DOES NEED to match to form a neighboring.

When two routers have the same router ID in an OSPF, domain routing may not function properly. If the router ID is the same on two neighboring routers, the neighbor establishment may not occur.

Like RIP, OSPF requires the use of the "default-information originate" command to advertise the static default route to the other routers in the area