CCNA Series Chapter 4: IP Routing and Open Shortest Path First (OSPF)

First of all if you are just beginning to prepare for CCNA, you need to read this post. This CCNA series chapter 4 post is the fourth installment of the CCNA series started in this post. Feel free to copy and paste, print and study from these little nuggets and of course, good luck for your CCNA.

Disclaimer: This is by no means a complete guide or syllabus for CCNA. This series will consists of details from the sheet that helped me prepare for CCNA and that’s why I am putting it up here online to help others too. I feel the book CCNA Routing and Switching Study Guide by Todd Lammle though easy is rather huge and can intimidate a lot of people who may wish to get CCNA certified but may lose heart after looking at that book. These main points and commands are derived from that book or you can say it is a selective summary of the book to help you prepare, revise and get CCNA certified.

Static Routing

Static routing is the process that ensures when you manually add routes in each router’s routing table. Predictably, there are pros and cons to static routing, but that’s true for all routing approaches.


  • There is no overhead on the router CPU, which means you could probably make do with a cheaper router than you would need for dynamic routing.
  • There is no bandwidth usage between routers, saving you money on WAN links as well as minimizing overhead on the router since you’re not using a routing protocol.
  • It adds security because you, the administrator, can be very exclusive and choose to allow routing access to certain networks only.


  • Whoever the administrator is must have a vault-tight knowledge of the internetwork and how each router is connected in order to configure routes correctly.
  • If you don’t have a good, accurate map of your internetwork, things will get very messy quickly!
  • If you add a network to the internetwork, you have to tediously add a route to it on all routers by hand, which only gets increasingly insane as the network grows.
  • Due to the last point, it’s just not feasible to use it in most large networks because maintaining it would be a full-time job in itself

Note: if the routes don’t appear in the routing table, it’s because the router can’t communicate with the next-hop address you’ve configured. But you can still use the permanent parameter to keep the route in the routing table even if the next-hop device can’t be contacted.

Configuring Static Routing

ip route [destination_network] [mask] [next-hop_address or exitinterface] [administrative_distance] [permanent]

next-hop_address This is the IP address of the next-hop router that will receive packets and forward them to the remote network, which must signify a router interface that’s on a directly connected network. You must be able to successfully ping the router interface before you can add the route. Important note to self is that if you type in the wrong nexthop address or the interface to the correct router is down, the static route will show up in the router’s configuration but not in the routing table.
exitinterface Used in place of the next-hop address if you want, and shows up as a directly connected route.
administrative_distance By default, static routes have an administrative distance of 1 or 0 if you use an exit interface instead of a next-hop address. You can change the default value by adding an administrative weight at the end of the command. I’ll talk a lot more about this later in the chapter when we get to the section on dynamic routing.
permanent If the interface is shut down or the router can’t communicate to the next-hop router, the route will automatically be discarded from the routing table by default. Choosing the permanent option keeps the entry in the routing table no matter what happens.

Corp#config t

Corp(config)#ip route 150

Shows up in the routing table as

S [150/0] via is subnetted, 2 subnets

Corp(config)#ip route s0/1 150

Shows up in the routing table as is directly connected, Serial0/1

Dynamic Routing

Administrative Distances

The administrative distance (AD) is used to rate the trustworthiness of routing information received on a router from a neighbor router. An administrative distance is an integer from 0 to 255,
where 0 is the most trusted and
255 means no traffic will be passed via this route.

Default Administrative Distances

Routing Protocols

There are three classes of routing protocols:
Distance vector The distance-vector protocols in use today find the best path to a remote network by judging distance. In RIP routing, each instance where a packet goes through a router is called a hop, and the route with the least number of hops to the network will be chosen as the best one. The vector indicates the direction to the remote network. RIP is a distance-vector routing protocol and periodically sends out the entire routing table to directly connected neighbors.
Link state In link-state protocols, also called shortest-path-first protocols, the routers each create three separate tables. One of these tables keeps track of directly attached neighbors, one determines the topology of the entire internetwork, and one is used as the routing table. Link-state routers know more about the internetwork than any distance-vector routing protocol ever could. OSPF is an IP routing protocol that’s completely link-state. Linkstate protocols send updates containing the state of their own links to all other directly connected routers on the network. This is then propagated to their neighbors.
Hybrid Hybrid protocols use aspects of both distance-vector and link-state protocols, and EIGRP is a great example—even though Cisco typically just calls EIGRP an advanced distance-vector routing protocol!


  • RIP is a true distance-vector routing protocol.
  • RIP sends the complete routing table out of all active interfaces every 30 seconds.
  • It relies on hop count to determine the best way to a remote network, but it has a maximum allowable hop count of 15 by default, so a destination of 16 would be considered unreachable.
  • RIP works okay in very small networks, but it’s super inefficient on large networks with slow WAN links or on networks with a large number of routers installed and completely useless on networks that have links with variable bandwidths!
  • RIP version 1 uses only classful routing, which means that all devices in the network mustuse the same subnet mask. This is because RIP version 1 doesn’t send updates with subnetmask information in tow.
  • RIP version 2 provides something called prefix routing and does send subnet mask information with its route updates. This is called classless routing.


Corp#config t

Corp(config)#router rip



Corp(config-router)#version 2

Corp(config-router)#no auto-summary


Corp#config t

Corp(config)#router rip

Corp(config-router)#passive-interface FastEthernet 0/1

This command will stop RIP updates from being propagated out of FastEthernet interface 0/0, but this can still receive RIP updates.


Corp(config)#ip route fa0/0

Corp(config)#router rip

Corp(config-router)#default-information originate


Gateway of last resort is to network

R* [120/1] via, 00:00:05, Serial0/0/1R2#


OSPF and RIP comparison

OSPF absolutely must have an area 0, the backbone area. and all other areas should connect to it
Area Border Router (ABR)

A router that connects other areas to the backbone area within an AS is called an area border router (ABR), and even these must have at least one of their interfaces connected to area 0.
Autonomous System Boundary Router (ASBR)

OSPF runs great inside an autonomous system, but it can also connect multiple autonomous systems together. The router that connects these ASs is called an autonomous system boundary router (ASBR).


Link A link is a network or router interface assigned to any given network. When an interface is added to the OSPF process, it’s considered to be a link. This link, or interface, will have up or down state information associated with it as well as one or more IP addresses.
Router ID The router ID (RID) is an IP address used to identify the router.

  • Cisco chooses the router ID by using the highest IP address of all configured loopback interfaces.
  • If no loopback interfaces are configured with addresses, OSPF will choose the highest IP address out of all active physical interfaces.

To OSPF, this is basically the “name” of each router.

Neighbor Neighbors are two or more routers that have an interface on a common network, such as two routers connected on a point-to-point serial link. OSPF neighbors must have a number of common configuration options to be able to successfully establish a neighbor relationship, and all of these options must be configured exactly the same way:

  1. Area ID
  2. Stub area flag
  3. Authentication password (if using one)
  4. Hello and Dead intervals


  • An adjacency is a relationship between two OSPF routers that permits the direct exchange of route updates.
  • OSPF will directly share routes only with neighbors that have also established adjacencies. And not all neighbors will become adjacentthis depends upon both the type of network and the configuration of the routers.
  • In multi-access networks, routers form adjacencies with designated and backup designated routers.
  • In point-to-point and point-to-multipoint networks, routers form adjacencies with the router on the opposite side of the connection.

Designated router

  • A designated router (DR) is elected whenever OSPF routers are connected to the same broadcast network to minimize the number of adjacencies formed and to publicize received routing information to and from the remaining routers on the broadcast network or link.
  • Elections are won based upon a router’s priority level, with the one having the highest priority becoming the winner.
  • If there’s a tie, the router ID will be used to break it.
  • All routers on the shared network will establish adjacencies with the DR and the BDR, which ensures that all routers’ topology tables are synchronized.

Backup designated router

  • A backup designated router (BDR) is a hot standby for the DR on broadcast, or multi-access, links.
  • The BDR receives all routing updates from OSPF adjacent routers but does not disperse LSA updates.

Hello protocol

  • The OSPF Hello protocol provides dynamic neighbor discovery and maintains neighbor relationships.
  • Hello packets and Link State Advertisements (LSAs) build and maintain the topological database.
  • Hello packets are addressed to multicast address
  • The frequency with which Hello packets are sent out depends upon the network type and topology.
  • Broadcast and point-to-point networks send Hellos every 10 seconds,
  • Non-broadcast and point-to-multipoint networks send them every 30 seconds.

Neighborship database

  • The neighborship database is a list of all OSPF routers for which Hello packets have been seen.
  • A variety of details, including the router ID and state, are maintained on each router in the neighborship database.

Topological database

  • The topological database contains information from all of the Link State Advertisement packets that have been received for an area.
  • The router uses the information from the topology database as input into the Dijkstra algorithm that computes the shortest path to every network.

Link State Advertisement

  • A Link State Advertisement (LSA) is an OSPF data packet containing link-state and routing information that’s shared among OSPF routers.
  • An OSPF router will exchange LSA packets only with routers to which it has established adjacencies.

LSA update multicast addresses

OSPF areas

  • An OSPF area is a grouping of contiguous networks and routers.
  • All routers in the same area share a common area ID.
  • Because a router can be a member of more than one area at a time, the area ID is associated with specific interfaces on the router.
  • All of the routers within the same area have the same topology table.
  • When configuring OSPF with multiple areas, you’ve got to remember that there must be an area 0 and that this is typically considered the backbone area.

Broadcast (multi-access) Broadcast (multi-access) networks such as Ethernet allow multiple devices to connect to or access the same network, enabling a broadcast ability in which a single packet is delivered to all nodes on the network. In OSPF, a DR and BDR must be elected for each broadcast multi-access network.
Nonbroadcast multi-access Nonbroadcast multi-access (NBMA) networks are networks such as Frame Relay, X.25, and Asynchronous Transfer Mode (ATM). These types of networks allow for multi-access without broadcast ability like Ethernet. NBMA networks require special OSPF configuration to function properly.
Point-to-point Point-to-point refers to a type of network topology made up of a direct connection between two routers that provides a single communication path. The point-to-point connection can be physical—for example, a serial cable that directly connects two routers—or logical, where two routers thousands of miles apart are connected by a circuit in a Frame Relay network. Either way, point-to-point configurations eliminate the need for DRs or BDRs.
Point-to-multipoint Point-to-multipoint refers to a type of network topology made up of a series of connections between a single interface on one router and multiple destination routers. All interfaces on all routers share the point-to-multipoint connection and belong to the same network. Point-to-multipoint networks can be further classified according to whether they support broadcasts or not. This is important because it defines the kind of OSPF configurations you can deploy.
OSPF Metrics

OSPF uses a metric referred to as cost. A cost is associated with every outgoing interface included in an SPF tree. The cost of the entire path is the sum of the costs of the outgoing interfaces along the path. Because cost is an arbitrary value as defined in RFC 2338, Cisco had to implement its own method of calculating the cost for each OSPF-enabled interface.

Cisco uses a simple equation of 108/bandwidth, where bandwidth is the configured bandwidth for the interface.

Using this rule, a 100 Mbps Fast Ethernet interface would have a default OSPF cost of 1 and a 1,000 Mbps Ethernet interface would have a cost of 1.

Important to note is that this value can be overridden with the ip ospf cost command. The cost is manipulated by changing the value to a number within the range of 1 to 65,535. Because the cost is assigned to each link, the value must be changed on the specific interface you want to change the cost on.


  • It’s really vital to configure loopback interfaces when using OSPF. In fact, Cisco suggests using them whenever you configure OSPF on a router for stability purposes.
  • Loopback interfaces are logical interfaces, which means they’re virtual, software-only interfaces, not actual, physical router interfaces.
  • A big reason we use loopback interfaces with OSPF configurations is because they ensure that an interface is always active and available for OSPF processes.
  • Loopback interfaces also come in very handy for diagnostic purposes as well as for OSPF configuration.
  • Understand that if you don’t configure a loopback interface on a router, the highest active IP address on a router will become that router’s RID during bootup!


  • The RID is not only used to advertise routes, it’s also used to elect the designated router (DR) and the backup designated router (BDR).
  • These designated routers create adjacencies when a new router comes up and exchanges LSAs to build topological databases.
  • By default, OSPF uses the highest IP address on any active interface at the moment OSPF starts up to determine the RID of the router.
  • But this behavior can be overridden via a logical interface. Remember—the highest IP address of any logical interface will always become a router’s RID!

For setting OSPF Router ID, OSPF follows this hierarchy:

  1. Highest active interface by default.
  2. Highest logical interface overrides a physical interface.
  3. The router-id overrides the interface and loopback interface.


Router(config)#router ospf ?

<1-65535> Process ID

  • A value in the range from 1 to 65,535 identifies the OSPF process ID.
  • It’s a unique number on this router that groups a series of OSPF configuration commands under a specific running process.
  • Different OSPF routers don’t have to use the same process ID to communicate.
  • It’s a purely local value that doesn’t mean a lot, but you still need to remember that it cannot start at 0; it has to start at a minimum of 1.

The OSPF process ID is needed to identify a unique instance of an OSPF database and is locally significant.

Router(config-router)# network network number wild card mask area 0

network area 0


  • A 0 octet in the wildcard mask indicates that the corresponding octet in the network must match exactly.
  • On the other hand, a 255 indicates that you don’t care what the corresponding octet is in the network number.

Router(config-router)#network area ?

<0-4294967295> OSPF area ID as a decimal value

A.B.C.D OSPF area ID in IP address format

Note: The areas can be any number from 0 to 4.2 billion. Don’t get these numbers confused with the process ID, which ranges from 1 to 65,535.

Test#config t

Test(config)#router ospf 1

Test(config-router)#network area 0

Test(config-router)#network area 0

Test(config-router)#network area 0

Test(config-router)#network area 0


LA(config)#router ospf 100

LA(config-router)#passive-interface fastEthernet 0/1


Corp#config t

Corp(config)#ip route Fa0/0

Corp(config)#router ospf 1

Corp(config-router)#default-information originate


Corp(config)#int loopback 0

*Mar 22 01:23:14.206: %LINEPROTO-5-UPDOWN: Line protocol on Interface

Loopback0, changed state to up

Corp(config-if)#ip address

You would think that because we set logical interfaces, the IP addresses under them would automatically become the RID of the router, right? Well, sort of, but only if you do one of two things: either reboot the router or delete OSPF and re-create the database on your router. Neither is all that great an option, so try to remember to create your logical interfaces before you start OSPF routing.


Corp#config t

Corp(config)#router ospf 1


Reload or use “clear ip ospf process” command, for this to take effect

Corp(config-router)#do clear ip ospf process

Reset ALL OSPF processes? [no]: yes

For setting OSPF Router ID, OSPF follows this hierarchy:

  1. Highest active interface by default
  2. Highest logical interface overrides a physical interface.
  3. The router-id overrides the interface and loopback interface.

More in this series:
How To Prepare For CCNA Certification
CCNA Series Chapter 1: Internetworking, Ethernet Networking And Data Encapsulation
CCNA Series Chapter 2: Introduction To TCP/IP and Easy Subnetting
CCNA Series Chapter 3: Cisco’s Internetworking Operating System (IOS) & Managing a Cisco Internetwork

– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –

Like what I write?

Follow me:

Facebook: Raiya Writes

Twitter: @raiyatweets

Instagram: raiyawrites

Hire Me: Raiya Hashmi (Freelance Journalist, Editor and Creative Writer)


One thought on “CCNA Series Chapter 4: IP Routing and Open Shortest Path First (OSPF)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s