Lab9 burhan

Embed Size (px)

Citation preview

  • 8/2/2019 Lab9 burhan

    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 linkstate routing protocol. We will use GNS3 (graphical network simulator) as asimulation tool for this lab. At the end of this lab you will be able toconfigure 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 atthe end of this document and upload the completed report to yourcourses LMS site.

    Avoid plagiarism by copying from the Internet or from your peers. Youmay 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 yourunderstanding.

    Background:

    As discussed in the previous lab, there are two types of routing protocolused in internetwork; one is called Intra-AS routing protocol while the otheris called Inter-AS routing protocol. Intra-AS routing protocols are used toexchange routing information with routers in the same autonomous system(AS). Autonomous System is a collection of networks which are under thesame administrative domain. On the other hand Inter-AS routing protocol isused to communicate between AS. Figure 1 shows classification of routingprotocol. OSPF is a type of Intra-AS routing protocol.

  • 8/2/2019 Lab9 burhan

    2/20

    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 protocolsare more complex than distance vector protocols, and running them adds tothe router's overhead. The additional overhead (in the form of memoryutilization and bandwidth consumption when link-state protocols first startup) constrains the number of neighbors that a router can support and thenumber of neighbors that can be in an area. When the network is stable,link-state protocols minimize bandwidth usage by sending updates onlywhen a change occurs. A hello mechanism ascertains reachability ofneighbors. When a failure occurs in the network, link-state protocols flood

    Link-State Advertisements (LSAs) throughout an area. LSAs cause everyrouter within the failed area to recalculate routes. The fact that LSAs needto be flooded throughout the area in failure mode and the fact that allrouters recalculate routing tables constrain the number of neighbors thatcan be in an area.

    Link state routing protocols, like distance vector protocols, are dynamic.They propagate route information across networks. However, they have anumber of advantages over distance vector protocols. The informationavailable to a distance vector router can be compared to the informationavailable 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 intomaking bad routing decisions, because it has a complete picture of the

  • 8/2/2019 Lab9 burhan

    3/20

    Computer and Communication Networks (CCN)

    SEECS, NUST

    Lab 9: Dynamic Routing - OSPF

    network. The reason is that unlike the routing-by-rumor approach ofdistance vector, link state routers have firsthand information from all theirpeer routers. Each router originates information about itself, its directlyconnected links, and the state of those links (hence the name). Thisinformation is passed around from router to router, each router making acopy of it, but never changing it. The ultimate objective is that every routerhas identical information about the internetwork, and each router willindependently calculate its own best paths. Link state protocols, sometimescalled shortest path first or distributed database protocols, are built arounda well-known algorithm from graph theory, E. W. Dijkstras shortest pathalgorithm.

    One of the major advantages of link-state routing is that they do not

    transmit their entire topology database across the network on a periodicbasis. Once the network has converged, protocol traffic is limited tochanges in specific links (link state advertisement packets) and keep-aliveor hello packets. Finally, convergence times for link state protocols aregenerally much shorter than for distance vector protocols. A network basedon link-state routing will recognize and adapt to failures and changes muchmore quickly.

    There are a few disadvantages to link state routing protocols that must beconsidered. They are generally much more complex than either staticroutes or distance-vector routing. This translates into higher

    implementation costs, higher CPU utilization, and greater memoryrequirements.

    Why do we call it link-state routing?

    OSPF is a link-state protocol. We could think of a link as being an interfaceon the router. The state of the link is a description of that interface and ofits relationship to its neighboring routers. A description of the interfacewould include, for example, the IP address of the interface, the mask, thetype of network it is connected to, the routers connected to that networkand so on. The collection of all these link-states would form a link-statedatabase.

    OSPFOSPF is an Interior Gateway Protocol (IGP) developed for use in InternetProtocol (IP)-based internetworks. As an IGP, OSPF distributes routinginformation between routers belonging to a single autonomous system (AS).An AS is a group of routers exchanging routing information via a commonrouting protocol. The OSPF protocol is based on shortest-path-first, or link-state, technology.

    Operation of OSPF

    At a very high level, the operation of OSPF is easily explained:

  • 8/2/2019 Lab9 burhan

    4/20

    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 becomeneighbors.

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

    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.

    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 ofthe 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 linkstate 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 informationabout the directly connected neighbors including their router ID, the

  • 8/2/2019 Lab9 burhan

    5/20

    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 link-

    state 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)

  • 8/2/2019 Lab9 burhan

    6/20

    Computer and Communication Networks (CCN)

    SEECS, NUST

    Lab 9: Dynamic Routing - OSPF

    Figure 2: A hierarchical network divided into multiple areas connectedthrough 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 dosummarization.

    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

  • 8/2/2019 Lab9 burhan

    7/20

    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 islarge. 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 inother 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 ID

    Hello and Dead timers

    Network Mask

    Area ID

    Router priority

    DR & BDR IP addressRouter ID:

    The router id is nothing but the routers name in the OSPF process.

    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.

  • 8/2/2019 Lab9 burhan

    8/20

    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 quicklyadapt to topology changes.

    There are two components to routing convergence:

    Detection of topology changes---OSPF uses two mechanisms to detecttopology changes. Interface status changes (such as carrier failure on aserial link) are the first mechanism. The second mechanism is failure ofOSPF to receive a hello packet from its neighbor within a timing windowcalled a dead timer. Once this timer expires, the router assumes theneighbor is down. The dead timer is configured using the ip ospf dead-interval interface configuration command. The default value of the deadtimer is four times the value of the Hello interval. That results in a deadtimer default of 40 seconds for broadcast networks and 2 minutes fornonbroadcast networks.

    Recalculation of routes---Once a failure has been detected, the routerthat detected the failure sends a link-state packet with the changeinformation to all routers in the area. All the routers recalculate all oftheir routes using the Dijkstra (or SPF) algorithm. The time required torun the algorithm depends on a combination of the size of the area andthe number of routes in the database.

    2) OSPF Network Scalability

  • 8/2/2019 Lab9 burhan

    9/20

    Computer and Communication Networks (CCN)

    SEECS, NUST

    Lab 9: Dynamic Routing - OSPF

    Your ability to scale an OSPF internetwork depends on your overall networkstructure and addressing scheme. As outlined in the preceding discussionsconcerning network topology and route summarization, adopting ahierarchical addressing environment and a structured address assignmentwill be the most important factors in determining the scalability of yourinternetwork.

    Network scalability is affected by operational and technical considerations:

    Operationally, OSPF networks should be designed so that areas do notneed to be split to accommodate growth. Address space should bereserved to permit the addition of new areas.

    Technically, scaling is determined by the utilization of threeresources: 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. Inaddition, it can store summaries and externals. Careful use ofsummarization 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 updatesare flooded to all routers in the area. In a quiet network, OSPF is a quietprotocol. In a network with substantial topology changes, OSPF minimizesthe 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 areamust agree on the value of the authentication field. Because OSPF is astandard protocol available on many platforms, including some hosts, usingthe authentication field prevents the inadvertent startup of OSPF in anuncontrolled platform on your network and reduces the potential forinstability.

    Controlling the routing information that routers exchange

  • 8/2/2019 Lab9 burhan

    10/20

    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 isnot 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 themaximum hop count of 16. A route with a hop count of 16 isunderstood 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 theNetwork 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.

  • 8/2/2019 Lab9 burhan

    11/20

    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 ipaddress command.

    Turn on each interface on which you configure IP address by using noshutdown command.

    Enable OSPF as a routing protocol on each router by using routerospf 1 command where 1 is the process ID.

    The OSPF process-id is a numeric value local to the router. It does nothave to match process-ids on other routers. It is possible to runmultiple OSPF processes on the same router, but is not recommendedas it creates multiple database instances that add extra overhead tothe router.

    Now you will tell the router the IP addresses of directly connectednetworks, so that the router can advertise it to the rest of thenetwork.

    You will need to issue network n.n.n.n c.c.c.c (where n.n.n.n is thenetwork address and c.c.c.c is the complementary subnet mask; thecomplementary mask for class C network address will be 0.0.0.255.

    The network command is a way of assigning an interface to a certainarea. 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 maskcontains wild card bits where 0 is a match and 1 is a "do not care" bit,

  • 8/2/2019 Lab9 burhan

    12/20

    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 thenetwork number.

    Save your configuration to NVRAM by using copy running-configstartup-config command.

    You can stop OSPF protocol on a router by using no router ospfcommand; similarly you can remove the network from router by usingno network command.

    OSPF configuration example:

    The configuration below demonstrates how the Lahore router must beconfigured. The other routers can be configured similarly.

    After configuring the IP address on the Ethernet and serial interfaces ofLahore, OSPF is configured as shown below:Lahore(config)# router ospf 1Lahore(config-router)# network 10.3.12.0 0.0.0.255 area 0Lahore(config-router)# network 10.3.13.0 0.0.0.255 area 0Lahore(config-router)# exitLahore(config)# exitLahore# copy running-config startup-config

    Now configure the other routers the same way and answer the questiongiven below.

    Questions:1. What are the network(s) which you will add to Karachi router(you must write exact commands that you used for configuration)?

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

  • 8/2/2019 Lab9 burhan

    13/20

    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 (youmust write exact commands that you used for configuration)?

    Gujranwala>enableGujranwala#config tGujranwala(config)#router ospf 1Gujranwala(config-router)#noGujranwala(config-router)#network 10.3.12.0 0.0.0.255 area 0Gujranwala(config-router)#network 10.3.11.0 0.0.0.255 area 0Gujranwala(config-router)#exitGujranwala(config)#exitGujranwala#copy running-config startup-config

    Destination filename [startup-config]?Building configuration...[OK]Gujranwala#disableGujranwala>

    3. How did you configure IP address on the serial port of Islamabadrouter?

    Islamabad>enable

    Islamabad#config tEnter configuration commands, one per line. End withCNTL/Z.Islamabad(config)#router ospf 1Islamabad(config-router)#network 10.3.11.0 0.0.0.255 area0Islamabad(config-router)#network 10.3.10.0 0.0.0.255 area0Islamabad(config-router)#exitIslamabad(config)#exit

    Islamabad#copy running-config startup-configDestination filename [startup-config]?Building configuration...[OK]Islamabad#disableIslamabad>

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

  • 8/2/2019 Lab9 burhan

    14/20

    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 theNetwork Address. O stands for OSPF.

  • 8/2/2019 Lab9 burhan

    15/20

    Computer and Communication Networks (CCN)

    SEECS, NUST

    Lab 9: Dynamic Routing - OSPF

    5. Display the routing table of Gujranwala. (snapshot required)

  • 8/2/2019 Lab9 burhan

    16/20

    Computer and Communication Networks (CCN)

    SEECS, NUST

    Lab 9: Dynamic Routing - OSPF

    6. Display the routing table of Islamabad. (snapshot required)

  • 8/2/2019 Lab9 burhan

    17/20

    Computer and Communication Networks (CCN)

    SEECS, NUST

    Lab 9: Dynamic Routing - OSPF

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

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

  • 8/2/2019 Lab9 burhan

    18/20

    Computer and Communication Networks (CCN)

    SEECS, NUST

    Lab 9: Dynamic Routing - OSPF

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

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

  • 8/2/2019 Lab9 burhan

    19/20

    Computer and Communication Networks (CCN)

    SEECS, NUST

    Lab 9: Dynamic Routing - OSPF

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

    The Age specified tells us about the duration in secondssince that certain router is active.

    It gives the information about the border Routers.

  • 8/2/2019 Lab9 burhan

    20/20

    Computer and Communication Networks (CCN)

    SEECS, NUST

    Lab 9: Dynamic Routing - OSPF