Dynamic Routing Distance Vector and Link State RIP OSPF Internet Routing • IP implements datagram forwarding • Both hosts and routers • Have an IP module •
Download ReportTranscript Dynamic Routing Distance Vector and Link State RIP OSPF Internet Routing • IP implements datagram forwarding • Both hosts and routers • Have an IP module •
Dynamic Routing
Distance Vector and Link State RIP OSPF
Internet Routing
• IP implements datagram forwarding • Both hosts and routers • Have an IP module • Forward datagrams • IP forwarding is table-driven • Table known as routing table
Routing Tables
• Static routing • Fixes routes at boot time • Useful only for simplest cases • Dynamic routing • Table initialized at boot time • Values inserted/updated by protocols that propagate route information -> Routers use dynamically protocols to learn new information and update their routing table • Necessary in large internets
Interdomain and Intradomain
• • • • 4
Intradomain Routing
Routing within an AS
Routing
Ignores the Internet outside the AS • •
Interdomain Routing
Routing between AS ’ s Assumes that the Internet consists of a collection of interconnected AS ’ s Protocols for Intradomain routing are also called
Interior Gateway Protocols
or
IGP
’
s
. • Normally, there is one dedicated router in each AS that handles interdomain traffic.
Popular protocols are • RIP (simple, old) • OSPF (better) • Protocols are collectively called
Exterior Gateway Protocols
or
EGP
’
s.
• Routing protocols: • Border Gateway Protocol (BGP) v4 current
Routing Domains
6
Components of a Routing Algorithm
• A procedure for sending and receiving reachability information about a network to other routers • A procedure for calculating optimal routes • Routes are calculated using a shortest path algorithm (least “ cost ”) • A procedure for reacting to and advertising topology changes
7
Two Basic Shortest Path Routing Algorithms
• • • •
Distance Vector Routing
Each node knows the distance (cost) to its directly connected neighbors A node sends periodically a list of routing updates to its neighbors.
If all nodes update their distances to destinations using neighbor information, the routing tables eventually converge New nodes advertise themselves to their neighbors.
• • •
Link State Routing
Each node knows the distance (cost) to its directly connected neighbors The distance information is broadcast to all nodes in the network Each node calculates the routing tables independently using global information.
8
Internet Routing Algorithms
Distance Vector
•
Routing Information Protocol (RIP)
•
Link State
Intermediate System Intermediate System (IS-IS) • Gateway-to-Gateway Protocol (GGP) •
Open Shortest Path First (OSPF)
• Exterior Gateway Protocol (EGP) • Interior Gateway Routing Protocol (IGRP)
Distance Vector Algorithm
• • Initialize routing table with one entry for each directly connected Network Periodically run a distance-vector update to exchange information with routers that are reachable over directly connected networks
Distance Vector Dynamic Updates
• • • • • Every router sends list of its routes to all its neighbors List contains pairs of destination network and distance Receiver replaces entries in its table if routing through the sender (i.e., router that just sent an update) is less expensive than the current route in its table Receiver propagates new routes next time it sends out an update Update Algorithm has well-known shortcomings (we will see an example later)
Updates Reflected in Table
Example
Assume : • link cost is 1 on all hops • all updates occur simultaneously • initially each router only knows the cost of connected interfaces = 0
.
Rip Convergence Example
After First Update
After Second Update
After Third Update
Last Update for Convergence
The Count-to-Infinity Problem
1 1
18 Network 4.0.0.0 goes down
Event: Update from B to C occurs
Node C uses that Update to Update its table
This same process repeats when B sends again its update to C, and vice versa. The metric will increase to infinity so this phenomenon is called “counting to infinity”
Count-to-Infinity
• The reason for the count-to-infinity problem is that each node ONLY has a “ next-hop-view ” • For example, in the first step, B did not realize that its route (with cost 1) to network 4.0.0.0 went through node C and C did not realize that B’s update was based on its connectivity information.
• How can the Count-to-Infinity problem 21 be solved?
How to Prevent Count to Infinity
.
• • SPLIT HORIZON: • A router never sends information about a route back in same direction which is original information came, routers keep track of where the information about a route came from. Means when router A sends update to router B about any failure network, router B does not send any update for same network to router A in same direction.
ROUTE POISONING: • Router consider route advertised with an infinitive metric to have failed ( metric=16) instead of marking it down. For example, when network 4 goes down, router C starts route poisoning by advertising the metric (hop count) of this network as 16, which indicates an unreachable network.
More….
• POISON REVERSE: • The poison reverse rule overwrites split horizon rule. For example, if router B receives a route poisoning of network 4 from router C then router B will send an update back to router C (which breaks the split horizon rule) with the same poisoned hop count of 16. This ensures all the routers in the domain receive the poisoned route update. Notice that every router performs poison reverse when learning about a downed network. In the above example, router A also performs poison reverse when learning about the downed network from B
•
More
HOLD DOWN TIMERS : • • • After hearing a route poisoning, router starts a hold-down timer for that route. If it gets an update with a better metric than the originally recorded metric within the hold-down timer period, the hold-down timer is removed and data can be sent to that network. Also within the hold-down timer, if an update is received from a different router than the one who performed route poisoning with an equal or poorer metric, that update is ignored. During the hold-down timer, the “downed” route appears as “possibly down” in the routing table.
For example, in the above example, when B receives a route poisoning update from C, it marks network 4 as “possibly down” in its routing table and starts the hold-down timer for network 4. In this period if it receives an update from C informing that the network 4 is recovered then B will accept that information, remove the hold-down timer and allow data to go to that network. But if B receives an update from A informing that it can reach network by 1 (or more) hop, that update will be ignored and the hold-down timer keeps counting.
Note: The default hold-down timer value = 180 second.
More
• • TRIGGERED UPDATE : • When any route failed in network ,do not wait for the next periodic update instead send an immediate update listing the poison route.
COUNTING TO INFINITY: • Maximum count 15 hops after it will not be reachable.
Characteristics of Distance Vector Routing
• •
Periodic Updates:
Updates to the routing tables are sent at the end of a certain time period. A typical value is 90 seconds.
Triggered Updates:
If a metric changes on a link, a router immediately sends out an update without waiting for the end of the update period.
•
Full Routing Table Update
: Most distance vector routing protocol send their neighbors the entire routing table (not only entries which change).
•
Route invalidation timers:
Routing table entries are invalid if they are not refreshed. A typical value is to invalidate an entry if no update is received after 3-6 update periods.
26
Link State Algorithm
• Alternative to distance-vector • Distributed computation • Broadcast information • Allow each router to compute shortest paths • Avoids problem where one router can damage the entire internet by passing incorrect information • Also called Shortest Path First (SPF)
Link State Update
• Participating routers learn internet topology • Think of routers as nodes in a graph, and networks connecting them as edges or links • Pairs of directly-connected routers periodically • Test link between them • Propagate (broadcast) status of link • All routers • Receive link status messages • Recompute routes from their local copy of information
RIP - Routing Information Protocol
• • • • • • • • A simple intradomain protocol Straightforward implementation of Distance Vector Routing Each router advertises its distance vector every 30 seconds (or whenever its routing table changes) to all of its neighbors (destination address, distance) Uses hop count metric and uses 1 as link metric Maximum hop count is 15, with “ 16 ” equal to “ ” Routes are timed out (set to 16) after 3 minutes if they are not updated Uses split horizon and poison reverse techniques to solve Inconsistencies Current standard is RIPv2 29
Two Forms of RIP
Active • Form used by routers • Broadcasts routing updates periodically • Uses incoming messages to update routes Passive • Form used by hosts • Uses incoming update messages to change route table – changes eliminate ICMP redirects • Does not send updates
Changes to RIP1 in RIPv2
• Update includes subnet mask • Authentication supported • Explicit next-hop information • Messages can be multicast (optional) • IP multicast address is 224.0.0.9
RIP1 Update Format
Route Tag: Used to carry information from other routing protocols (e.g., autonomous system number)
33
RIP Messages
• Dedicated port for RIP is UDP port 520.
• Two types of command messages: •
Request messages
• used to ask neighboring nodes for an update •
Response messages
• contains an update
34
Routing with RIP
•
Initialization:
Send a
request packet
on all interfaces requesting routing tables from neighboring routers: • • RIPv1 uses broadcast if possible, RIPv2 uses multicast address 224.0.0.9, if possible •
Request received
: Routers that receive above request send their entire routing table •
Response received
: Update the routing table • •
Regular routing updates
: Every 30 seconds, send all or part of the routing tables to every neighbor in a response message
Triggered Updates:
Whenever the metric for a route changes, send entire routing table.
RIP Summary
• Slow convergence • Limited to 16 hops • Only uses local information for routing decisions (from neighbors) - relies on others (propagation) for global information
Open Shortest Path First (OSPF)
• Uses Link State routing • Each node requires complete topology information • Link state information must be flooded to all nodes (uses multicasting) • Cost metric used to calculate shortest paths. Metric can be any link or network parameter (time, congestion, bandwidth, $$, distance) or a function that combines several weighted parameters • Guaranteed to converge
Link State Routing: Basic principles
1. Each router establishes a relationship
(
“
adjacency
”
)
with its neighbors 2.Each router generates
link state advertisements (LSAs)
which are distributed to all routers (after all routers have established adjacencies).
LSA = (link id, state of the link, cost, neighbors of the link) 3. Each router maintains a database of all received LSAs (
topological database
or
link state database
), which describes the network has a graph with weighted edges 4. Each router uses its link state database to run a shortest path algorithm (Dijikstra ’ s algorithm) to produce the shortest path to each network 37
38
Operation of a Link State Routing protocol
Received LSAs Link State Database Dijkstra ’ s Algorithm IP Routing Table LSAs are flooded to other interfaces
39
Features of OSPF
• Provides authentication of routing messages • Enables load balancing by allowing traffic to be split evenly across routes with equal cost • Type-of-Service routing allows setup of different routes dependent on the TOS field in IP header • Uses AREAs to subdivide large networks, providing a hierarchical structure and limit the multicast LSAs within routers of the same area. Area 0 is called the backbone area and all other areas connect directly to it. All OSPF networks must have a backbone area
OSPF Areas
Area Border Routers (ABR) are any routers that have one interface in one area and another interface in another area
OSPF Operation
• • • Link-state routing protocols generate routing updates only when a change occurs in the network topology.
When a link changes state, the device that detected the change creates a link-state advertisement (LSA) concerning that link and sends to all neighboring devices using a special multicast address.
Each routing device takes a copy of the LSA, updates its link-state database (LSDB), and forwards the LSA to all neighboring devices using multicasting in broadcast environments.
OSPF Operation contd.
• • • • The entire routing table (LSDB) is transmitted once every 30 minutes Routing information is shared through Link-state updates (LSAs) HELLO messages are used to maintain adjacent neighbors. • By default, OSPF routers send Hello packets every 10 seconds on multiaccess and point-to-point segments and every 30 seconds on non-broadcast multiaccess (NBMA) segments (e.g. frame relay).
It is a classless routing protocol. It sends the subnet mask in the routing update.
Link State Advertisements (LSA)
• OSPF routers use LASs to describe its link state.
• An LSDB stores all received LSAs on a router.
• A router uses Router LSA to describe its interface IP addresses.
• After OSPF is started on a router, it creates an LSDB that contains one entry: this router’s Router LSA
Types of OSPF Messages
• 1.
There are five types of OSPF Link-State Packets (LSPs).
Hello: are used to establish and maintain adjacency with other OSPF routers. They are also used to elect the Designated Router (DR) and BackupDesignated Router (BDR) on multiaccess networks (like Ethernet or Frame Relay).
2.
Database Description (DBD or DD): contains an abbreviated list of the sending router’s link-state database and is used by receiving routers to check against the local link-state database
LSPs contd.
3.
4.
5.
Link-State Request (LSR): used by receiving routers to request more information about any entry in the DBD Link-State Update (LSU): used to reply to LSRs as well as to announce new information. LSUs contain seven different types of Link-State Advertisements (LSAs) Link-State Acknowledgement (LSAck): sent to confirm receipt of an LSU message
OSPF Packet Format
IP header OSPF Message OSPF Message Header
OSPF packets are not carried as UDP payload!
OSPF has its own IP protocol number:
89 Body of OSPF Message Message Type Specific Data LSA LSA
...
...
LSA
TTL: set to 1 (in most cases)
LSA Header LSA Data
Destination IP: neighbor ’ s IP address or 224.0.0.5 (ALLSPFRouters) or 224.0.0.6 (AllDRouters) 46
OSPF Packet Format
OSPF Message Header
2: current version is OSPF V2 Message types: 1: Hello (tests reachability) 2: Database description 3: Link Status request 4: Link state update 5: Link state acknowledgement Standard IP checksum taken over entire packet
Body of OSPF Message version type message length source router IP address Area ID checksum authentication type authentication authentication 32 bits
ID of the Area from which the packet originated 0: no authentication 1: Cleartext password 2: MD5 checksum (added to end packet) 47
OSPF Hello Message
Example of OSPF
• Suppose OSPF has just been enabled on R1 & R2. Both R1 and R2 are very eager to discover if they have any neighbors nearby but before sending Hello messages they must first choose an OSPF router identifier (router id) to tell their neighbors who they are. The Router ID (RID) is an IP address used to identify the router and is chosen using the following sequence: • The highest IP address assigned to a loopback (logical) interface.
• If a loopback interface is not defined, the highest IP address of all active router’s physical interfaces will be chosen.
• The router ID can be manually assigned
Example contd.
• • In this example, suppose R1 has 2 loopback interfaces & 2 physical interfaces: • Loopback 0: 10.0.0.1
• Loopback 1: 12.0.0.1
• eth0/0: 192.168.1.1
• eth0/1: 200.200.200.1
The loopback interfaces are preferred to physical interfaces (because they are never down) so the highest IP address of the loopback interfaces is chosen as the router-id -> Loopback 1 IP address is chosen as the router-id.
Router 1
Router 2
Next Step – Hello Msgs
• Now both the routers have the router-id so they will send Hello packets on all OSPF-enabled interfaces to determine if there are any neighbors on those links. • The information in the OSPF Hello includes the OSPF Router ID of the router sending the Hello packet.
Hello Msg R1 to R2
• • R1 wants to find out if it has any neighbor running OSPF it sends a Hello message to the multicast address 224.0.0.5. This is the multicast address for all OSPF routers and all routers running OSPF will process this message.
Discovery of Neighbors
• Routers multicasts OSPF Hello packets all OSPF-enabled interfaces.
on • If two routers share a link, they can become neighbors, and establish an adjacency
10.1.10.1
10.1.10.2
Scenario: Router 10.1.10.2 restarts
OSPF Hello OSPF Hello: I heard 10.1.10.2
55 • After becoming a neighbor, routers
Establishing adjacency
• If an OSPF router receives an OSPF Hello packet that satisfied all its requirement then it will establish adjacency with the router that sent the Hello packet. In this example, if R1 meet R2′s requirements, meaning it has: • the same Hello interval, • Dead interval and • AREA number • R2 will add R1 to its neighbor table.
Hello Msg Adjacency Parameters
• • • Hello interval: indicates how often it sends Hello packets.
Dead interval: number of seconds this router should wait between receiving hello packets from a neighbor before declaring the adjacency to that neighbor down AREA number: the area it belongs to
Next – Exchange DD or DBD packets
• • • • R1 and R2 are neighbors but they don’t exchange LSAs immediately. Instead, they send Database Description (DD or DBD) packets which contain an abbreviated list of the sending router’s link-state database.
The neighbors also determine who will be the master and who will be the slave. The router with higher routerid will become master and initiates the database exchange. The receiver acknowledges a received DD packet by sending an identical DD packet back to the sender.
Each DD packet has a sequence number and only the master can increment sequence numbers.
DD Msg Exchange
Neighbor discovery and database synchronization
10.1.10.1
10.1.10.2
Discovery of adjacency
OSPF Hello OSPF Hello: I heard 10.1.10.2
After neighbors are discovered the nodes exchange their databases Sends database description. (description only contains LSA headers) Acknowledges receipt of description 60
Database Description: Sequence = X Database Description: Sequence = X, 5 LSA headers = Router-LSA, 10.1.10.1, 0x80000006 Router-LSA, 10.1.10.2, 0x80000007 Router-LSA, 10.1.10.3, 0x80000003 Router-LSA, Router-LSA, Router-LSA, 10.1.10.4, 0x8000003a 10.1.10.5, 0x80000038 10.1.10.6, 0x80000005 Database Description: Sequence = X+1, 1 LSA header= Router-LSA, 10.1.10.2, 0x80000005 Database Description: Sequence = X+1
Sends empty database description Database description of 10.1.10.2
LSA Request
R1 or R2 can send Request to get missing LSA from its neighbors
R2 sends back an LSAck packet to acknowledge the packet
LSA Exchange
LSA exchanges – Request and Response
10.1.10.1
10.1.10.2
10.1.10.1 sends requested LSAs
Link State Request packets, LSAs = Router-LSA, Router-LSA, Router-LSA, 10.1.10.1, 10.1.10.2, 10.1.10.3, Router-LSA, Router-LSA, Router-LSA, 10.1.10.4, 10.1.10.5, 10.1.10.6, Link State Update Packet, LSAs = Router-LSA, 10.1.10.1, 0x80000006 Router-LSA, 10.1.10.2, 0x80000007 Router-LSA, 10.1.10.3, 0x80000003 Router-LSA, 10.1.10.4, 0x8000003a Router-LSA, 10.1.10.5, 0x80000038 Router-LSA, 10.1.10.6, 0x80000005 Link State Update Packet, LSA = Router-LSA, 10.1.1.6, 0x80000006
63 10.1.10.2 explicitly requests each LSA from 10.1.10.1
10.1.10.2 has more recent value for 10.0.1.6 and sends it to 10.1.10.1
(with higher sequence number)
Creating LSDBs
• • • • • • Note that first routers exchange DD msgs that only list the content of the LSDB but no details.
Once a router gets that info, it can then check to see if it has that information in its LSDB.
If it doesn’t it requests an LSA to fill in the details.
Reliable transmission: when a router receives an Update, it sends an Ack to the Update sender.
If the sender does not receivie Ack within a specific peried, it times out and retransmits Update.
OSPF uses Update-Ack to implement relaible transmission. It does not use TCP!
65
Routing Data Distribution
• LSA-Updates are distributed to all other routers via
Reliable Flooding
•
Example:
Flooding of LSA from 10.10.10.1
10.10.10.1
10.10.10.2
10.10.10.4
10.10.10.6
LSA LSA ACK Update database Update database Update database Update database
10.10.10.2
LSA Update database
10.10.10.5
Dissemination of LSA-Update
• A router sends and refloods LSA-Updates, whenever the topology or link cost changes. (If a received LSA does not contain new information, the router will not flood the packet) • Exception: Infrequently (every 30 minutes), a router will flood LSAs even if there are no new changes. • Acknowledgements of LSA-updates: • • explicit ACK, or implicit via reception of an LSA-Update 66
OSPF Tables
• There are 3 type of tables stored at a Router: • Neighbor • Topology • Routing
Neighbor Table
• Contain information about the neighbors • Neighbor is a router which shares a link on same network • Another relationship is adjacency • Not necessarily all neighbors • LSA updates are only when adjacency is established
Topology Table
• Contains information about all network and paths to reach any network • All LSA’s are entered into the topology table • When topology changes, LSA’s are generated and router sends new LSA’s • Using the topology table a shortest path connectivity graph is created (routing table), the algorithm is known as SPF or Dijkstra’s algorithm
Routing Table
• Also known as forwarding database • Generated when an algorithm is run on the topology database • Routing table for each router is unique