OSPF is a link-state routing protoocol which uses factors such as speed or the link’s shortest path to decide which route is the best.
Link state protocol routers maintain a common picture of the network and exchange link informantion during discovery and/or network changes.
OSPF is designed for large and scalable networks, becauses of the following advantages:
- Convergence speed
- OSPF sends only routing changes instead of the entire routing table. Because of the small routing changes, updates are flooded rapidly across the network
- Support for VLSM
- Network size
- Use of bandwidth
- OSPF uses multicast to advertertise the updates: LSU’s (link state updates) are small in packetsize
- path selection
- OSPF selects optimal routes using cost instead of hopcount (RIP)
- Member groupings
- OSPF uses areas: every network segment is cut into smaller areas of routers: less LSU’s are sent out and more efficient routing takes place. eh Every router in a area does have the same topology table.
When two routers receive each other Hello packets, Database Descriptions (DDs) are sent. DDs contain the headers of each LSA. These headers are used to identify every LSA. Routers sent every LSA they know about. When a router receives a DD about a unknown network, this LSA is requested in the next phase. A DD packet can contain multiple LSA headers. Every DD is acknowledged by sending an identical DD back to the sender. The window size for this is only 1 packet.
The OSPF multicast address for DR communication is 220.127.116.11
- DD (desription of link state database content)
- LSR (request for specific parts of the link state database)
- LSU (transports LSA’s to routers)
- LSAck (ack of a neighbor’s LSA)
- OSPF process has not exchanged any information with any neighbor
- Init state
- Router send Type 1 packets (Hellos) at regular intervals to establish a neigbor. Default: 10 sec. When a interface received the first Hello, router enters Init state.
- Two way state
- After some Hello packets, Two way state is entered. A router enters the two way state when it see’s itself in his neigbors hello packet. To learn routes, there has to be a adjacency relationship. In this relationship, not only Hello’s are exchanged but also on the other four types of OSPF packets. The next step to become adjacend is the Exstart
- This is the first step to become adjacend. In this state, Type 2 DD’s are sent. The two routers exchagne Hello packets to see who is the “master” in the relationship and they use DDs to exchange and compair the databases. The higher router ID becomes master.
- Exchange state
- In this state, type 2 DD’s are send to each other. In this state, the routers compair and requests each other databases.
- Loading state
- After compairing each others databases, requests are send out (Type 3 packets: LSR). When a router received an LSR, it responds with an update by a LSU (type 4) packet. These LSU’s contain the actual LSA. LSU’s are acknowledged with type 5 packets; LSAcks
- Fully adjacency
- Once information exchanged, routers enter this state. During this state routers keeps a list of adjacent neighbors, called the adjacencies database.
- Discover OSPF routers
- Check config parameters
- Moniter health of the neighbor
Routers listen for multicasts on 18.104.22.168 on any interface that is enabled for OSPF. Hello’s do always have the interface IP as source address (source never will be secondary IP address, but those are advertised). OSPF neighbors will become fully adjecent when one or both routers used unnumbered interfaces for the connection between them. When two routers discoverd each other, the following parameters are checked:
- Same primary subnet
- Same OSPF area
- Same area type (stub, NSSA)
- Not have identical RIDs
- Equal Hello and dead timers
In case one of these don’t match, no neighborship is formed. The OSPF process ID does not have to match, because it’s a local setting on the router itself. Also important is a identical MTU size between the routers. This is not part of the hello parameter check, but incase of a mismatch, no neighborship is formed.
OSPF interface recognize three types of networks: broadcast multiaccess, nonbroadcast multiaccess and point to point links. the point to multipoint connection is configured by the admin.
Designated Router (DR)
Backup designated router (BDR)
Both only used on multiaccess networks.Both are routers that are elected by all other routers on the LAN to represent all the routers. The DR router is critical, so there is a BDR. Without the concept of a DR, each pair of routers that share a data
link would become fully adjacent neighbors. Each pair of routers would directly exchange their LSDBs with each other. On a LAN with only six routers, without a DR, 15 different pairs of routers would exist, and 15 different instances of full database flooding would occur. OSPF uses a DR (and backup DR, or BDR) on a LAN or other multiaccess network. The flooding occurs through the DR, significantly reducing the unnecessary exchange of redundant LSAs.
In case of a network topology change, a DD is sent to the DR by multicast. The DR acknowledges this packet by sending an ack back as a unicast (this ack is the same DD as the original router sent out). The DR sends a multicast DD to all OSPF routers.
A router who is not the DR or BDR are called the DROther router. the DR and BDR will form full adjacencies with all routers on the LAN segment. When the database exchange process finished, they reach the “full state”. Two routers who are both DROther routers will never become fully adjancent: they finish at the 2-way state.
The election starts when two routers become neighbors and before they start sending DDs. If there is a DR address of 0.0.0.0 in a Hello packet, no DR has been elected yet. In this case, the routers wait untill all other routers are initialized so all routers can participate in the DR election process. The following rules are used for the election:
- Every router with a OSPF prio set between 1-255
- Routers check the Hello packets, for other router ID’s
- If a Hello packet contains a better ID, the router stops claiming be the DR
- Criteria: Higher prio
- When the prio’s are the same: higher RID
- The router not claiming the DR but with a higher prio will become BDR
When a new router is added with a higher prio, that router can not take DR function over. When DR failed, BDR becomes DR and there will be a new election process for the BDR.
OSPF areas, path selection, filtering, authentication and common configuration options will be discussed in a next blog.