First steps with OSPFv2(it uses IPv4)
In a world dominated by distance vectors, a rebel protocol came into play: OSPF, which is a link-state protocol. It came to change the rules of the game.
Interview question: “What’s is a link-state protocol and how it is different from a distance vector?”
Wrong answer: eeh, eehh ummm. 0/10 points(that won’t be you).
Short answer: Distance vector can see their directly connected neighbor but Link-state have a global vision of the area devices. 3/10 points.
Medium answer: Distance vectors (like RIP) depends on trusting their neighbor for the information (often called routing as rumor) , every neighbor will have a different topology table that will show their vision of the network. Link-state however, they are similar to a GPS or a blueprint, where every router know exactly to which router is connected to, how many links and their Ips addresses. All routers in the same link-state area share the same database, it is synchronized. 6/10 points well done!
Long answer 10/10 points:
- Distance vectors: Example of distance vector are RIP, we can say EIGRP is an advance distance vector(as we used delay and bandwith for example to calculate metric, instead of just hops like RIP). Distance vectors cannot see the full topology information(think as topology as the full map) and they only know what their adjacent neighbors tell them. They usually avoid loops using mechanisms as split horizon.
- Link-state protocol: OSPF and IS-IS are the IGP link state protocols that are more common. They can “see” the whole picture of the network area, like a map where they agree on which router is connected to which and the link they have together with the IP information. Database is the same for all routers in an area, it is synchronized. They have several methods to verify they have the latest database information like sequence numbers.
OSPF is used in campus and some provider environments, and it is an open standard which can be found in other vendors hardware apart from Cisco.
How OSPF works? How do we find neighbors?
Before we start finding our neighbors we have to define our router-id, which it is just an unique identifier for thar router. That number is a 32 bit value, that looks like an IP with a format of x.x.x.x but that router-id do not need to be reachable or routable. It will be used in the Hellos to identify each unique router.
- Normally the router-id will be manually defined by the admin.
- If it’s not manually configured, then OSPF will take the higher loopback interface IP.
- If there is no loopback then it will use the highest IP address configured into any interface.
Best practice is to define it yourself, so you it can help you later when you have to troubleshoot.
After having a router-id, we start sending hellos out of the interfaces we configure with OPSF network command (or inside the interface itself you can enable OSPF also). Soon or later our router will hear another hello from other router
With a different router-id and if they agree in certain parameters, they will become adjacent neighbors (friends).
Note: If you want to change the router-id after the OSPF started to work, you have to reset the router(don’t do it) or clear the ospf process (clear ip ospf X process, where X is the process number)
The exact details of what need to be matched between neighbors to become a neighbor will be detailed in another post, remember that hello timer and dead timer has to match between neighbors.
Once we have neighbors, the database will be exchanged between all neighbors inside the same area and after a while all the routers will agree that the database is the same for all of them. Now the routers are synchronized. If there is any change in the network, new information will be sent into the area and later the routers will converge. (to converge is to agree and to be synchronized).
Why we have areas? Can we just use one area?
Areas are regions that fall under the same logical grouping, for example R1 and R2 belong to Area 0; both are under the same group.
Areas are needed for scale, as they provide us several advantages:
- Routers only will have detailed knowledge inside the area, Area 1 routers will know everything of the area, but not Area 3 routers. This saves memory and CPU resources.
- Routers only have to share the same exact database with routers on its own area, saving again resources like memory.
- Several areas, means less packets need to be sent to maintain the database information. (known as LSAs, Link State Advertisements). As there will be less routers per area with several areas, instead of a bigger area.
We can have one single area if you want, it depends on the number of routers in the area and how stable it is. If you have a single area you can use any number for the area id, but it is always recommended to use Area 0 as your first area(also called backbone), because if later you need more areas you need to have an Area 0 as a requirement.
Area 0 serves as a loop prevention mechanism, as all other areas must traverse through Area 0 to reach any other area, having that way a sort of distance vector behavior! Area 0 will be always in the middle of two areas.
Fancy stuff to know about OSPF
OSPF is a link-state protocol as we said that uses IP protocol number 89, also uses multicast address 126.96.36.199 and 188.8.131.52.
There is a role called DR(Designated Router) and BDR(Backup Designated Router) that can be seen in OPSF network type Broadcast and Non-broadcast multiaccess. Having a DR helps to minimize the quantity of packets that are sent into an area, with a DR in the segment the DR will be the only one that will flood the information. All the other routers will report to the DR and BDR only, then DR will send updates to all routers.
There are several types of LSAs (Link State Advertisement) that are used to carry information about the subnets, the connection of the routers between each other and the area types. LSAs are used also to carry information between areas in a controlled way. That topic will be discussed in other post as it is a big topic.
Areas can be changed into any of the 4 area types(stub, totally stub, nssa and totally nssa), each area will allow certain LSAs and block other, giving to the network admin much more control of what they want to allow into each area.
OSPFv2 works with IPv4, but there is another OSPFv3 that uses IPv6 as a transport mechanism(IPv6 must be enabled for it to work). OSPFv3 is for most part equivalent to OSPFv2, but it has a few optimizations compared with OPSFv2. All this post was related with OSPFv2.
This is a very basic introduction to one of the most interesting protocols out there, in further post we will discuss about: areas, LSAs, BDR/DR election and many other things yet to come.
OSPF is not so well known as EIGRP but that is going to change for you, OSPF will be your best friend soon.
What do you think?
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?