Simulation of OSPF routing protocol

smashlizardsNetworking and Communications

Oct 29, 2013 (4 years and 8 months ago)


Department of Electrical Engineering
Sharif University of Technology
Data Networks
Dr. M. Pakravan 1

Simulation of OSPF routing
Configure and analyze the performance of the Open Shortest Path First (OSPF) routing protocol
A router in the network needs to be able to look at a packet’s destination address and determine the
output port that is the best choice to get the packet to that address. The router makes this decision by
consulting a forwarding table. The fundamental problem of routing for the routers is to acquire the
information in their forwarding tables.
Routing algorithms are required to build the routing tables and hence forwarding tables. The basic
problem of routing is to find the lowest-cost path between any two nodes, where the cost of a path
equals the sum of the costs of all the edges that make up the path. Routing is achieved in most
practical networks by running routing protocols among the nodes. The protocols provide a distributed,
dynamic way to solve the problem of finding the lowest-cost path in the presence of link and node
failures and changing edge costs. One of the main classes of routing algorithms is the distance-vector
algorithm. Each node constructs a vector containing the distances (costs) to all other nodes and
distributes that vector to its immediate neighbours. RIP is the canonical example of a routing protocol
built on the distance-vector algorithm. Routers running RIP send their advertisements regularly (e.g.,
every 30 seconds). A router also sends an update message whenever a triggered update from another
router causes it to change its routing table. In this class of routing protocols, each node has direct
information about its neighbours and distributes the distance vectors only to its neighbours. This
prevents them from having a global view of the network and its topology.
Link-state routing is the second major class of intra-domain routing protocol. The basic idea behind link-
state protocols is very simple: Every node knows how to reach its directly connected neighbours, and if
we make sure that the totality of this knowledge is disseminated to every node, then every node will
have enough knowledge of the network to build a complete map of the network. Once a given node
has a complete map for the topology of the network, it is able to decide the best route to each
destination. Calculating those routes is based on a well-known algorithm from graph theory—Dijkstra’s
shortest-path algorithm.
OSPF introduces another layer of hierarchy into routing by allowing a domain to be partitioned into
areas. This means that a router within a domain does not necessarily need to know how to reach every
network within that domain—it may be sufficient for it to know how to get to the right area. Thus, there is
a reduction in the amount of information that must be transmitted to and stored in each node. In
addition, OSPF allows multiple routes to the same destination to be assigned the same cost and will
cause traffic to be distributed evenly over those routers.

Department of Electrical Engineering
Sharif University of Technology
Data Networks
Dr. M. Pakravan 2

In this lab, you will set up a network that utilizes OSPF as its routing protocol. You will analyze the
routing tables generated in the routers and will observe how the resulting routes are affected by
assigning areas and enabling load balancing.

Basic OSPF Scenario
Create a new project and add the routers model to your objects palette. Add eight routers of type
slip8_gtwy to your project workspace and add a link model of bidirectional PPP_DS3 to your project
links and use this type of link to connect the routers. Rename the routers as shown below.

We need to assign link costs to match the following graph:

Now you should specify costs for router interfaces
Right Click ⇒ Edit attributes ⇒ OSPF parameters ⇒ Interface Information ⇒Cost

You can also set the cost value to auto calculate and change the interface bandwidth. OPNET router
models support a parameter called a reference bandwidth to calculate the actual cost, as follows:
Cost = (Reference bandwidth) / (Interface bandwidth)
The Reference Bandwidth can be specified on a per-router basis and its default value is 1,000,000
Kbps. For example, to assign a cost of 5 to a link, assign a bandwidth of 200,000 Kbps to that link. The
bandwidth parameter is also among interface information of OSPF. Note that this is not the actual
bandwidth of the link in the sense of transmission speed, but merely a parameter used to configure link

Department of Electrical Engineering
Sharif University of Technology
Data Networks
Dr. M. Pakravan 3

costs. If you set this parameter to default, it would be considered as the actual link bandwidth
connected to that interface.
Select all links in your network that correspond to the links with a cost of 5 in the above graph by shift-
clicking on them.
Right Click ⇒ Edit attributes ⇒ OSPF parameters ⇒ Interface Information.
Create a traffic demand between RouterA and RouterC by putting each router in a subnet and
connecting Ethernet work stations or LANs to each router in a way that stations connected to router
send traffic to stations connected to RouterC. Create a traffic demand between RouterB and RouterH
by the same method.
Choose the routing protocol to be OSPF:
Select the Protocols menu ⇒ IP ⇒ Configure Dynamic Routing Protocols.

Also be sure to export the routing table. To control routing table export and import, use the “Routing
Table Import/Export” simulation attribute in the “Configure Simulation” dialog box.
Auto assigns all IP addresses
Select the Protocols menu ⇒ IP ⇒ Addressing ⇒ Select Auto-Assign IP Addresses.
Select areas for OSPF
OSPF can summarize a set of routes within an area, so that only a summary of the routes is advertised
into other areas. Therefore, an OSPF network can be divided into several areas, where each area is
typically a group of contiguous networks and attached hosts. Routing information from one area is
disseminated to other areas by area border routers (ABRs), which are routers that belong to multiple
areas. The OSPF backbone is responsible for distributing routing information among areas. All areas
must be connected to the backbone area, by an ABR or by a virtual link. By default, all routers are
configured to belong to the backbone area
Duplicate the scenario that you have made in the previous part. In the new scenario, there are 3 areas
configured (including the Backbone). Area 1 is connected to the Backbone via routers A and C and
area 2 is connected to backbone via routers F and G.
Define the first area including Router A, Router B and Router C:
Select the three links that connect RouterA, RouterB, and RouterC by shiftclicking on them ⇒ Select the Protocols menu
⇒ OSPF ⇒ Configure Areas ⇒ Assign the value to the Area Identifier ⇒ Click OK.
Repeat the previous step for the three links that connect RouterF, RouterG, and RouterH but assign the
value to their Area Identifier.
To visualize the areas we just created:
Select the Protocols menu ⇒ OSPF ⇒ Visualize Areas
The network uses different colours assigned to each area .Note that the area you did not configure is
the backbone area and its Area Identifier is

Department of Electrical Engineering
Sharif University of Technology
Data Networks
Dr. M. Pakravan 4

Balanced Scenario
When there are multiple paths of equal cost to a destination, OSPF includes all of these paths in the IP
routing table. This allows load balancing across equal-cost paths to a given destination.
Duplicate the previous scenario. In the new scenario, select both RouterB and RouterH by shift-clicking
on them and configure their load balancing option.
Edit Attributes ⇒ IP Routing Parameters ⇒ Load Balancing Options ⇒ Make sure that the option is Packet-Based ⇒
Click OK.

Run the simulations once for each of the previous scenarios and answer the following questions:

1. Using the simulation log, examine the generated routing table in RouterA for each of the three
scenarios. The routing table is available in simulation log under class category, IP subclass and route
table name.
Each route has a metric or cost associated with it, which is the hop count to the destination.
Explain the values assigned to the Metric column of each route. You can view the simulation log by
right clicking on the project screen and choosing view simulation log.
 Make sure that you set the routing table export parameter of the specified router to “once at the
end of simulation”. This parameter is in IP routing parameters of the router.
 Recall that these IP addresses are assigned automatically during simulation, and we set the
global attribute IP Interface Addressing Mode to export this information to a file. This will allow
you to check the automatically assigned IP addresses to the interfaces of the network. This
attribute can be set in the configure simulation advanced dialog. OPNET will then create a gdf
file that includes the IP addresses assigned to the interfaces of the Routers in our network. To
view the IP assignment information that has been saved in this file, use the following
From the File menu choose Open ⇒ from the drop-down menu choose Generic Data File ⇒ Select your file ⇒ Click OK.

2. Explain why the Areas and Balanced scenarios result in different routes than those observed in the
first scenario, for the same pair of routers.

3. OPNET allows you to examine the link-state database that is used by each router to build the
directed graph of the network. Examine this database for RouterA in the first scenario. Show how
RouterA utilizes this database to create a map for the topology of the network and draw this map (This
is the map that will be used later by the router to create its routing table.)
 To export the link-state database of a router, Edit the attributes of the router and set the Link
State Database Export parameter (one of the OSPF Parameters, under Processes) to ‘Once’
at End of Simulation.

Department of Electrical Engineering
Sharif University of Technology
Data Networks
Dr. M. Pakravan 5

 After re-running the simulation, you can check the link-state database by opening the
simulation log. The link-state database is available in class category, OSPF subclass and
LSDB_Export name.

4. Create another scenario as a duplicate of the first scenario. In this new scenario simulate a failure of
the link connecting RouterD and RotuerE. Have this failure start after 100 seconds. Rerun the
simulation. Show how that link failure affects the content of the link-state database and routing table of
 You should add a Failure Recovery object to your workspace (this node model should be
added to your object palette).
Right-click on the Failure object ⇒ Edit Attributes ⇒ Expand the Link Failure/Recovery Specification hierarchy ⇒ Set
rows to 1 ⇒ set the attributes of the added row to fail your specified route at your desired time.
 You will need to disable the global attribute OSPF Sim Efficiency. This will allow OSPF to
update the routing table if there is any change in the network.

5. In the previous scenario collect the Traffic Sent (bits/sec) statistic (one of the Global Statistics under
OSPF). Rerun the simulation for those two scenarios and obtain the graph that compares the OSPF’s
Traffic Sent (bits/sec) in this scenario with the first scenario. Comment on the obtained graph.

Experiment Report
Write a proper report using MS Word and include the results and discussions of your results in the
report. You should then pack this report with the project file in your OPNET (The project Name should
be the same as your name_LAB5), zip them and send one file to the E-mail address of the course. The
received file should contain:
• The OPNET project
• The report that includes the answer to the above questions.