Вы находитесь на странице: 1из 20

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

Lab Title: Dynamic Routing OSPF Objective of this lab: The goal of this lab is to introduce you how to run open shortest path first (OSPF) on a network. OSPF is Dynamic Routing protocol and it uses link state routing protocol. We will use GNS3 (graphical network simulator) as a simulation tool for this lab. At the end of this lab you will be able to configure OSPF on the given network topology. Instructions: Read carefully before starting the lab. These exercises are to be done individually.

You are supposed to provide the answers to the questions listed at the end of this document and upload the completed report to your courses LMS site. Avoid plagiarism by copying from the Internet or from your peers. You may refer to source/ text but you must paraphrase the original work. Your submitted work should be written by yourself. Complete the lab half an hour before the lab ends.

At the end of the lab, a viva will be conducted to evaluate your understanding. Background: As discussed in the previous lab, there are two types of routing protocol used in internetwork; one is called Intra-AS routing protocol while the other is called Inter-AS routing protocol. Intra-AS routing protocols are used to exchange routing information with routers in the same autonomous system (AS). Autonomous System is a collection of networks which are under the same administrative domain. On the other hand Inter-AS routing protocol is used to communicate between AS. Figure 1 shows classification of routing protocol. OSPF is a type of Intra-AS routing protocol.

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

Figure 1: Classification of routing protocol

Link state Routing: Link-state routing protocols, such as Open Shortest Path First (OSPF) was designed to address the limitations of distance vector routing protocols (slow convergence and unnecessary bandwidth usage). Link-state protocols are more complex than distance vector protocols, and running them adds to the router's overhead. The additional overhead (in the form of memory utilization and bandwidth consumption when link-state protocols first start up) constrains the number of neighbors that a router can support and the number of neighbors that can be in an area. When the network is stable, link-state protocols minimize bandwidth usage by sending updates only when a change occurs. A hello mechanism ascertains reachability of neighbors. When a failure occurs in the network, link-state protocols flood Link-State Advertisements (LSAs) throughout an area. LSAs cause every router within the failed area to recalculate routes. The fact that LSAs need to be flooded throughout the area in failure mode and the fact that all routers recalculate routing tables constrain the number of neighbors that can be in an area. Link state routing protocols, like distance vector protocols, are dynamic. They propagate route information across networks. However, they have a number of advantages over distance vector protocols. The information available to a distance vector router can be compared to the information available from a road sign. Link state routing protocols, on the other hand, are more like a road map. A link state router cannot be fooled as easily into making bad routing decisions, because it has a complete picture of the

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

network. The reason is that unlike the routing-by-rumor approach of distance vector, link state routers have firsthand information from all their peer routers. Each router originates information about itself, its directly connected links, and the state of those links (hence the name). This information is passed around from router to router, each router making a copy of it, but never changing it. The ultimate objective is that every router has identical information about the internetwork, and each router will independently calculate its own best paths. Link state protocols, sometimes called shortest path first or distributed database protocols, are built around a well-known algorithm from graph theory, E. W. Dijkstras shortest path algorithm. One of the major advantages of link-state routing is that they do not transmit their entire topology database across the network on a periodic basis. Once the network has converged, protocol traffic is limited to changes in specific links (link state advertisement packets) and keep-alive or hello packets. Finally, convergence times for link state protocols are generally much shorter than for distance vector protocols. A network based on link-state routing will recognize and adapt to failures and changes much more quickly. There are a few disadvantages to link state routing protocols that must be considered. They are generally much more complex than either static routes or distance-vector routing. This translates into higher implementation costs, higher CPU utilization, and greater memory requirements. Why do we call it link-state routing? OSPF is a link-state protocol. We could think of a link as being an interface on the router. The state of the link is a description of that interface and of its relationship to its neighboring routers. A description of the interface would include, for example, the IP address of the interface, the mask, the type of network it is connected to, the routers connected to that network and so on. The collection of all these link-states would form a link-state database. OSPF OSPF is an Interior Gateway Protocol (IGP) developed for use in Internet Protocol (IP)-based internetworks. As an IGP, OSPF distributes routing information between routers belonging to a single autonomous system (AS). An AS is a group of routers exchanging routing information via a common routing protocol. The OSPF protocol is based on shortest-path-first, or linkstate, technology. Operation of OSPF At a very high level, the operation of OSPF is easily explained:

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF 1. OSPF-speaking

routers send Hello packets out all OSPF-enabled interfaces. If two routers sharing a common data link agree on certain parameters specified in their respective Hello packets, they will become neighbors. formed between some neighbors. OSPF defines several network types and several router types. The establishment of an adjacency is determined by the types of routers exchanging Hellos and the type of network over which the Hellos are exchanged.

2. Adjacencies, which may be thought of as virtual point-to-point links, are

3. Each router sends link state advertisements (LSAs) over all adjacencies.

The LSAs describe all of the router's links, or interfaces, and the state of the links. These links may be to stub networks (networks with no other router attached), to other OSPF routers, to networks in other areas, or to external networks (networks learned from another routing process). Because of the varying types of link state information, OSPF defines multiple LSA types.
4. Each router receiving an LSA from a neighbor records the LSA in its link

state database and sends a copy of the LSA to all of its other neighbors. 5. By flooding LSAs throughout an area, all routers will build identical link state databases.
6. When the databases are complete, each router uses the SPF algorithm to

calculate a loop-free graph describing the shortest (lowest cost) path to every known destination, with itself as the root. This graph is the SPF tree. 7. Each router builds its route table from its SPF tree. Types of tables used by OSPF: There are three types of tables used in OSPF. Neighbor Table Topology Table Routing Table

Neighbor Table The router tracks all the neighbors which is running OSPF as a routing protocol and put that information in this table. It contains all the information about the directly connected neighbors including their router ID, the

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

networks they are connected to, and which network they are advertising. It will exchange routing information with routers which is in this table. Topology Table This is the one of the big difference between distance-vector and linkstate protocols. Distance vector protocol does not have this topology table. They only know about the directly connected neighbors. This table is a road map for each and every single network which is available in a particular area. All the routers in a particular area will be having the same type of topology table. Routing Table This table contains all the best routes to reach a particular network. Based on the topology table it will be having multiple paths for a single destination network. It will run the SPF algorithm to find the best routes for each and every network. The algorithm places each router at the root of a tree and calculates the shortest path to each destination based on the cumulative cost required to reach that destination. Each router will have its own view of the topology even though all the routers will build a shortest path tree using the same link-state database. Area design and Terminology The Characteristics of OSPF Area OSPF divides the network into multiple areas. Each area can contain N number of routers. All the Areas should connect to Area 0(Backbone area) All the routers within the same area will be having the same topology table It contains one Autonomous system border system router(ASBR)

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

Figure 2: A hierarchical network divided into multiple areas connected through the backbone area (Area 0).

The routers those which have interfaces in multiple areas are called Area Border Router (ABR). A router which connects, OSPF with other routing protocol is called as Autonomous System Border Router (ASBR). A router which is only in Area 0 or Backbone area is known as Backbone area router. Why we are dividing networks into multiple areas? The goal is to localize routing updates within the same area It requires a Hierarchical design in IP address allocation. ABR & ASBR are the only two router types where we can do summarization.

Motivation of using Areas: A flat network (single area): Lets consider we are running a company with 100 routers. We are using OSPF as an internal routing protocol. All the routers which are running OSPF will be having same topology of the entire network. If any link goes down at any point of network, all the routers will

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

come to know about that link failure. Then all the routers will run SPF algorithm to find an alternative path to reach the other networks. It will take more time to converge and to calculate an alternative path if the network is large. The purpose of area is to minimize this. A hierarchical network (multiple areas): If we split those 100 routers into 2 areas which we call Area 1 and Area 2 such that each area contains 50 routers. Both these areas are connected to the backbone area known as Area 0. In this scenario Area 1 does not care about any changes that happen in Area 2. If any link in Area 2 goes down that will be localized within Area 2 only; only those routers which are in Area 2 need to run SPF to find the alternative path. Since the routers in one area do not have to recompute their routing table due to link failures or network changes in other areas, OSPF will converge quickly hence allowing the protocol to scale to larger networks. Understanding the OSPF neighbor relationships Routers that share a common segment become neighbors on that segment. Neighbors are elected via the Hello protocol. Hello packets are sent periodically out of each interface using IP multicast. Routers become neighbors as soon as they see themselves listed in the neighbor's Hello packet. To discover the neighbor, OSPF will send hello packets via the OSPF enabled interface. This hello packet contains the following information. Router Router ID Hello and Dead timers Network Mask Area ID Router priority DR & BDR IP address ID: process.

The router id is nothing but the routers name in the OSPF Highest active interface will become router id. Hello and Dead timers:

OSPF exchanges Hello packets on each segment. This is a form of Keepalive used by routers to acknowledge their existence on a segment.

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

The dead interval is the number of seconds that a router's Hello packets have not been received before its neighbors consider to be down. Hello packets are sent once in every 10 secs on Broadcast/point to point network & 30 secs on Non Broadcast Multi-Access.

When no routers become neighbors? Two routers will not become neighbors unless the following conditions are met:

They need to be in same Area. They need to have same Mask. Hello and Dead timers should be same on both the routers. Password should be same on both the routers, if Authentication is enabled. Features of OSPF: 1) OSPF Convergence One of the most attractive features about OSPF is the ability to quickly adapt to topology changes. There are two components to routing convergence: Detection of topology changes---OSPF uses two mechanisms to detect topology changes. Interface status changes (such as carrier failure on a serial link) are the first mechanism. The second mechanism is failure of OSPF to receive a hello packet from its neighbor within a timing window called a dead timer. Once this timer expires, the router assumes the neighbor is down. The dead timer is configured using the ip ospf deadinterval interface configuration command. The default value of the dead timer is four times the value of the Hello interval. That results in a dead timer default of 40 seconds for broadcast networks and 2 minutes for nonbroadcast networks.

Recalculation of routes---Once a failure has been detected, the router that detected the failure sends a link-state packet with the change information to all routers in the area. All the routers recalculate all of their routes using the Dijkstra (or SPF) algorithm. The time required to run the algorithm depends on a combination of the size of the area and the number of routes in the database.

2) OSPF Network Scalability

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

Your ability to scale an OSPF internetwork depends on your overall network structure and addressing scheme. As outlined in the preceding discussions concerning network topology and route summarization, adopting a hierarchical addressing environment and a structured address assignment will be the most important factors in determining the scalability of your internetwork. Network scalability is affected by operational and technical considerations: Operationally, OSPF networks should be designed so that areas do not need to be split to accommodate growth. Address space should be reserved to permit the addition of new areas. Technically, scaling is determined by the utilization of three resources: memory, CPU, and bandwidth. 2.1) Memory An OSPF router stores all of the link states for all of the areas that it is in. In addition, it can store summaries and externals. Careful use of summarization and stub areas can reduce memory use substantially. 2.2) CPU An OSPF router uses CPU cycles whenever a link-state change occurs. Keeping areas small and using summarization dramatically reduces CPU use and creates a more stable environment for OSPF. 2.3) Bandwidth OSPF sends partial updates when a link-state change occurs. The updates are flooded to all routers in the area. In a quiet network, OSPF is a quiet protocol. In a network with substantial topology changes, OSPF minimizes the amount of bandwidth used. 3) OSPF Security Two kinds of security are applicable to routing protocols: Controlling the routers that participate in an OSPF network

OSPF contains an optional authentication field. All routers within an area must agree on the value of the authentication field. Because OSPF is a standard protocol available on many platforms, including some hosts, using the authentication field prevents the inadvertent startup of OSPF in an uncontrolled platform on your network and reduces the potential for instability. Controlling the routing information that routers exchange

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

All routers must have the same data within an OSPF area. As a result, it is not possible to use route filters in an OSPF network to provide security. Comparison between OSPF Vs RIP RIP:

RIP can scale to smaller networks due to the upper limit on the maximum hop count of 16. A route with a hop count of 16 is understood to be unreachable by the RIP protocol. RIPv1 does not support VLSM and CIDR. Periodic update of routing table consumes lots of bandwidth especially on WAN links. RIP converges slower than OSPF does.

OSPF

No limitations on the hop count. Can use VLSM. Converges quickly. Can divide the overall network into hierarchical units known as Area. This allows OSPF to scale to larger networks. Allows Authentication. It uses Dijkstras algorithm (SPF Algorithm) Reduced usage of BW, by sending triggered updates to announce the Network changes. Sends periodic updates after long intervals (30 Mins).

Unlike RIP, OSPF does not send any routing updates on periodic intervals. It only sends triggered updates whenever there is a change in the topology, e.g, when a new router is added to/ or removed from the network.

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

Lab Tasks: Configuration of OSPF on Cisco Routers

Figure 3: Network topology for OSPF configuration

General configuration steps:


Configure the IP address on each interface of a router using ip address command. Turn on each interface on which you configure IP address by using no shutdown command. Enable OSPF as a routing protocol on each router by using router ospf 1 command where 1 is the process ID. The OSPF process-id is a numeric value local to the router. It does not have to match process-ids on other routers. It is possible to run multiple OSPF processes on the same router, but is not recommended as it creates multiple database instances that add extra overhead to the router.

Now you will tell the router the IP addresses of directly connected networks, so that the router can advertise it to the rest of the network. You will need to issue network n.n.n.n c.c.c.c (where n.n.n.n is the network address and c.c.c.c is the complementary subnet mask; the complementary mask for class C network address will be 0.0.0.255. The network command is a way of assigning an interface to a certain area. The mask is used as a shortcut and it helps putting a list of interfaces in the same area with one line configuration line. The mask contains wild card bits where 0 is a match and 1 is a "do not care" bit,

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

e.g. 0.0.255.255 indicates a match in the first two bytes of the network number.

Save your configuration to NVRAM by using copy running-config startup-config command. You can stop OSPF protocol on a router by using no router ospf command; similarly you can remove the network from router by using no network command.

OSPF configuration example: The configuration below demonstrates how the Lahore router must be configured. The other routers can be configured similarly. After configuring the IP address on the Ethernet and serial interfaces of Lahore, OSPF is configured as shown below: Lahore(config)# router ospf 1 Lahore(config-router)# network 10.3.12.0 0.0.0.255 area 0 Lahore(config-router)# network 10.3.13.0 0.0.0.255 area 0 Lahore(config-router)# exit Lahore(config)# exit Lahore# copy running-config startup-config Now configure the other routers the same way and answer the question given below. Questions: What are the network(s) which you will add to Karachi router (you must write exact commands that you used for configuration)?
1.

Karachi(config)#router ospf 1 Karachi(config-router)#network 10.3.13.0 0.0.0.255 area 0 Karachi(config-router)#exit Karachi(config)#exit Karachi# Karachi#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK] Karachi#disable Karachi>

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF 2. What are the network(s) which you will add to Gujranwala router (you

must write exact commands that you used for configuration)? Gujranwala>enable Gujranwala#config t Gujranwala(config)#router ospf 1 Gujranwala(config-router)#no Gujranwala(config-router)#network 10.3.12.0 0.0.0.255 area 0 Gujranwala(config-router)#network 10.3.11.0 0.0.0.255 area 0 Gujranwala(config-router)#exit Gujranwala(config)#exit Gujranwala#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK] Gujranwala#disable Gujranwala> How did you configure IP address on the serial port of Islamabad router?
3.

Islamabad>enable Islamabad#config t Enter configuration commands, one per line. End with CNTL/Z. Islamabad(config)#router ospf 1 Islamabad(config-router)#network 10.3.11.0 0.0.0.255 area 0 Islamabad(config-router)#network 10.3.10.0 0.0.0.255 area 0 Islamabad(config-router)#exit Islamabad(config)#exit Islamabad#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK] Islamabad#disable Islamabad>

Display the routing table of Lahore router and explain how you find out that the links are using OSPF protocol?( snapshot required)
4.

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

We know it is OSPF, because of the O in the start of the Network Address. O stands for OSPF.

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

5.

Display the routing table of Gujranwala. (snapshot required)

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF 6.

Display the routing table of Islamabad. (snapshot required)

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

How can you check if the host with IP address 10.3.13.2 is accessible from Murree router (snapshot required)?
7.

We can see so by pinging 10.3.13.2 while we are in Murrees Console: As the Result is 100%, thus it is accessible.

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

Issue the show ip ospf neighbor command at the Lahore router. Show the output and explain what information is accessible through the output of this command?
8.

It tells the information about the neighboring nodes of the directly connected routers, the Interfaces at which the neighboring routers are connected to, The Addresses of those Networks.

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

Compare the OSPF routing database at Lahore and Karachi and compare them. Are both the routers using the same OSPF routing database? (You can see the OSPF database by issuing the command show ip ospf database)
9.

The Age specified tells us about the duration in seconds since that certain router is active. It gives the information about the border Routers.

Computer and Communication Networks (CCN) SEECS, NUST Lab 9: Dynamic Routing - OSPF

Вам также может понравиться