How To Set Up Ospf Between Two Cisco Routers?



In this blog post, we will show you how to set up OSPF between two Cisco routers. This will allow you to create a redundant network that can automatically failover if one of the links goes down.

OSPF Packet Types

OSPF Packet Types

Each OSPF packet type serves a specific purpose within the protocol. There are several different types of packets used in OSPF, each with a unique function:

  1.  Hello Packets – Used to establish and maintain adjacencies between neighbors. Hello packets are sent periodically and contain information about the sending router, including its Router ID, area ID, and list of neighbors.
  2. Database Description (DBD) Packets – Used to exchange database information between neighbors. DBD packets contain a list of LSAs that the sending router has in its database.
  3. Link State Request (LSR) Packets – Used to request specific LSAs from a neighbor. LSR packets contain a list of LSAs that the requesting router does not have in its database.
  4. Link State Update (LSU) Packets – Used to send LSAs to neighboring routers. LSU packets can be unsolicited (sent without request) or solicited (in response to an LSR).
  5. Link State Acknowledgement (LSAck) Packets – Used to acknowledge receipt of LSAs from neighboring routers.

LSA Header

LSA Header:

The LSA header is the most important part of the LSA. It contains all of the information that is necessary for OSPF to function properly. The header includes the following fields:

  • LS age: This field indicates how long the LSA has been in existence. When an LSA is first created, its LS age is set to 0. As the LSA ages, this field is incremented by 1 every time the LSA is transmitted. When an LSA reaches MaxAge, it is flushed from all routers’ LSDBs and must be recalculated.
  • Options: This field specifies various options that may be enabled for the router advertising the LSA. The options are bit-encoded, so multiple options may be enabled at once. Some of the more common options are: E (External routes), MC (Multicast capable), and NP (No Partial updates).
  •  LS type: This field indicates what type of LSA this is. There are many different types of LSAs, each with its own purpose. Some of the more common types are Router LSAs, Network LSAs, and Summary LSAs.
  • Link State ID: This field identifies the particular piece of information that this LSA represents. For example, if this were a Router LSA, then the Link State ID would represent the router’s OSPF router ID.
  • Advertising Router: This field contains the router ID of the router that originated this LSA.
  •  LS sequence number: This field is used to keep track of different versions of the same LSA. When an LSA is first created, it is given a sequence number of 0x80000001. Each time the LSA changes, the sequence number is incremented by 1. If a router receives an LSA with a lower sequence number than what it already has in its LSDB, it will assume that the new LSA is more recent and replace the old one with it. If a router receives an LSA with a higher sequence number than what it has in its LSDB, it will assume that the new LSA is outdated and simply discard it.
  • Checksum: This field contains a checksum of the entire LSA, excluding the LS age field. The checksum is used to verify the integrity of the LSA.
  • Length: This field indicates how long the LSA is, in bytes.

Router LSA

Router LSAs are the most common type of LSA and are originated by every router in an OSPF area. A Router LSA contains information about the links (interfaces) that connect the router to other devices in the same area, as well as any links to areas outside of the router’s own area.

Router LSAs are used by OSPF routers to build their routing tables and calculate the best path to each destination. Router LSAs are also used by DRs and BDRs to elect themselves and choose backup links.

Network LSA

In computer networking, a link state advertisement (LSA) is a data structure used to describe the state of a network. A network can be anything from a single local area network (LAN) to an entire wide area network (WAN). LSAs are exchanged between routers running a link state routing protocol such as Open Shortest Path First (OSPF) or IS-IS in order to build and maintain a map of the network.

Each LSA contains information about therouter that originated it, the state of the link(s) to other routers, and other attributes such as cost and bandwidth. When a router receives an LSA from another router, it uses this information to update its own view of the network. In this way, all routers in the network eventually have the same view of the network topology.

The most common type of LSA is the router LSA, which contains information about the links connecting a router to other routers in the network. Router LSAs are generated by every router in the network and flooded throughout the entire OSPF domain. Another common type of LSA is the Network LSA, which is generated by designated routers (DRs) to describe multi-access networks such as Ethernet LANs.

Summary LSA

In this section, we will provide a summary of the LSA process between two Cisco routers. This will include an overview of the steps necessary to establish OSPF adjacency between the routers, as well as a brief description of the LSA process itself. We will also discuss some of the common problems that can occur during this process and how to troubleshoot them.

External LSA

When configuring OSPF on a Cisco router, the first thing you need to do is identify the interfaces that will be participating in OSPF. In this example, we will configure OSPF on two FastEthernet interfaces. Once you have identified the interfaces, you need to enable OSPF on them by entering the ‘ip ospf’ command.

The next step is to assign a unique router ID to each router. The router ID can be any 32-bit number and is typically assigned to the router using the ‘router-id’ command. In this example, we will assign the router ID of to RouterA and the router ID of to RouterB:

RouterA(config)#router ospf 1

RouterB(config)#router ospf 1


In order to set up OSPF between two Cisco routers, it is necessary to first configure authentication. Authentication ensures that only authorized devices are able to access the network and prevents unauthorized devices from spoofing or impersonating other devices on the network.

There are two main types of authentication that can be used with OSPF: simple password authentication and MD5 authentication. Simple password authentication is the most basic form of authentication and uses a static password that is configured on both devices. MD5 authentication is more secure than simple password authentication and uses a dynamic hash that is generated based on a shared secret key.

Once the type of authentication has been decided, it must be configured on both devices. The router ID, area ID, and interface IP address must be entered into the configuration along with the chosen authentication method. After the configuration has been applied, the routers will begin exchanging hellos and forming adjacencies.

Configuration of Cisco Routers

Configuring two Cisco routers to use the OSPF protocol can be done in a few simple steps. First, make sure that both routers have OSPF enabled and are configured to use the same router ID. Next, configure each router with the network command to identify which interfaces should be included in OSPF routing. Finally, use the area command to assign each interface to an OSPF area.

Enabling OSPF and configuring the router ID can be done in router configuration mode with the router ospf and router-id commands, respectively. The network command is used in OSPF configuration mode and tells the router which interfaces should participate in OSPF routing. The area command is also used in OSPF configuration mode and assigns an interface to an OSPF area.

Here is an example of how to configure two Cisco routers for OSPF:

Router 1:
router ospf 1
network area 0

Router 2:
router ospf 1
network 0

The show ip ospf command

The show ip ospf command allows you to view information about the Open Shortest Path First (OSPF) routing protocol. This command can be used to view the status of OSPF neighbors, interfaces, and areas. You can also use this command to troubleshoot OSPF issues.

The Basics of OSPF

Open Shortest Path First (OSPF) is a link-state routing protocol for Internet Protocol (IP) networks. It uses a shortest path first (SPF) algorithm to calculate the best path to each router in a network. OSPF is a Classless Inter-Domain Routing (CIDR) protocol and can support variable-length subnet masks (VLSMs).

OSPF is widely used in large enterprise networks because of its many benefits, including its ability to scale to very large networks, support for VLSMs and CIDRs, fast convergence, and support for equal-cost multipath routing.

When configuring OSPF on Cisco routers, there are a few things to keep in mind. First, OSPF requires that all participating routers be configured with the same router ID (RID). The RID is an 32-bit number that uniquely identifies each router in an OSPF network. The RID can be any number between 1 and 4,294,967,295.

Second, when configuring OSPF on Cisco routers, you must specify which interfaces will be participating in the OSPF routing process. This is done by creating what is called an “interface range” which includes all of the interfaces that should be included in the OSPF process. You can then apply various OSPF parameters to this interface range which will be applied to all interfaces included in the range.

Setting up OSPF between two Cisco routers

In order to set up OSPF between two Cisco routers, you will need to configure the router interfaces and then create an OSPF network.

1 Configure the router interfaces:

  • Connect each router to the other router using an Ethernet cable.
  •  Make sure that each interface is in the same subnet. For example, if your first router has an IP address of, then your second router should have an IP address in the range (e.g.,
  • Configure a unique IP address for each interface on both routers.
  •  Enable OSPF on each interface using the “ip ospf” command:

    interface GigabitEthernet0/0
    ip ospf 1 area 0
    interface GigabitEthernet0/1
    ip ospf 1 area 0                                                                                                                                                           2.Create an OSPF network:

  •  On both routers, use the “router ospf” command to create an OSPF network and specify a unique process ID number:

    router ospf 1

  •  Specify the area number for each router using the “ospf area” command:

    router ospf 1 # First Router’s Configuration <br> area 0


In conclusion, setting up OSPF between two Cisco routers is a relatively easy process. By following the steps outlined in this article, you should be able to quickly and easily configure OSPF on your own Cisco routers. If you run into any problems along the way, feel free to reach out to our team of experts for help.

Leave a Reply

Your email address will not be published. Required fields are marked *