Network Layer Design and Routing Algorithms
Network Layer Design and Routing Algorithms
Laboratory Component:
bellman-ford algorithm
5. Comparison of Virtual-Circuit and Datagram • The packet is received, verified, and stored.
Subnets
• Then it is forwarded to the next router.
– The services should be independent of the router technology • 40+ years of experience with the computer network,
– The transport layer should be shielded from the number, type, unreliable internet, hosts doing error control and flow
and topology of the routers present. control.
– The network addresses made available to the transport layer should – Connection-oriented services:
use a uniform numbering plan, even cross LANs and WANs.
• 100+ years of experience with the worldwide telephone
• Two types of network layer services:
system, quality of service.
– Connection-oriented service vs connected-less service
Connection-less + connection-oriented services.
RoutingAlgorithms: RoutingAlgorithms:
Introduction Introduction
• The main function of the network layer is to route • A router performs two tasks:
packets from the source machine to the destination machine. – To forward the incoming packet according to the routing table
(Forwarding)
• The routing algorithm is used to decide which output line an
– To fill in and update the routing table (Routing)
incoming packet should be transmitted on
• Desirable properties in a routing algorithm:
– For datagram networks, this decision must be made anew
– Correctness , simplicity : no comment
for every arriving data packet since the best route may have
– Robustness : The routing algorithm should cope with changes in the
changed since last time. topology and traffic without requiring all processes in all hosts to be
– For virtual-circuit networks, this decision is made only aborted and the network to be rebooted every time some router crashes.
when a new virtual circuit is being set up. Thereafter, data – Stability: A stable algorithm reaches equilibrium and stays there.
packets just follow the previously established route. – Fairness Efficiency: Conflict between fairness and efficiency.
RoutingAlgorithms:
Introduction
Routing Algorithms: Introduction
• Classes of routing algorithms
Conflict between fairness and efficiency. – Nonadaptive algorithms do not base their routing decisions on
measurements or estimates of the current traffic and topology.
Instead, the choice of the route to use to get from I to J (for all I .
and J) is computed in advance, off-line, and downloaded to the
routers when the network is booted.
RoutingAlgorithms:
The optimality principle
• How to damp the flooding process: – with each graph node representing a router and
– One is to have a hop counter contained in the header of each – each graph edge representing a communication line.
packet, which is decremented at each hop. • To choose a route between a given pair of routers, the algorithm just
– The other is to keep track of which packets have been flooded, to finds the shortest path between them.
avoid sending them out a second time. • How to measure path length:
• A variation of flooding that is slightly more practical is selective
– Hops , Physical distance, Bandwidth, traffic, cost , measured
flooding.
delay , mean queue length and
• Flooding is not practical in most applications, but it does have
– Other factors or combinations of these factors.
some uses such as military applications.
19-03-2024
– Each node is labeled with its distance from the source node along
the best known path.
– As the algorithm proceeds and paths are found, the labels may
change, reflecting better paths. A label may be either temporary
or permanent.
RoutingAlgorithms: RoutingAlgorithms:
Shortest path routing Shortest path routing
19-03-2024
RoutingAlgorithms: RoutingAlgorithms:
Distance vector routing Distance vector routing
• Assume that
• Distance vector routing(Bellman-Ford routing):
– delay is used as a metric and that the router knows the delay to each of its
– Each router maintains a vector or table giving
neighbors.
• the best known distance to each destination and – Once every Tmsec, each router sends to each neighbor a list of its estimated
• which line to use to get there. delays to each destination. It also receives a similar list from each neighbor.
• Imagine
– These tables are updated by exchanging information with the
– one of these tables has just come in from neighbor X, with Xi being’s
neighbors. To update these tables
estimate of how long it takes to get to router i.
• Measure its distance to its neighbors
– If the router knows that the delay to X is m msec,
• Receive the vectors from its neighbors – Then it can reach router i via X in Xi + m msec.
• Compute its own new vector. • By performing this calculation for each neighbor, a router can find out which
estimate seems the best and use that estimate and the corresponding link in its
RoutingAlgorithms: RoutingAlgorithms:
Distance vector routing Distance vector routing
The count-to-infinity problem The count-to-infinity problem
• Distance-vector routing has the drawback that while cost increases (bad
news) propagate slowly, cost decreases (positive news) propagate quickly.
• Distance-vector routing takes some time for all other routers to become
aware of a broken connection (cost becomes infinity), which is necessary
So in this example, the Bellman-Ford algorithm will converge for
for a routing protocol to function properly.
• Counting to infinity is the name given to the issue. each router, they will have entries for each other. B will know that it
• A broken link's cost may not always be registered as infinite by all routers can get to C at a cost of 1, and A will know that it can get to C via B
until numerous updates have passed. at a cost of 2.
RoutingAlgorithms: RoutingAlgorithms:
Distance vector routing Distance vector routing
The count-to-infinity problem
RoutingAlgorithms: RoutingAlgorithms:
Link State routing Link State routing
• Problems with distance vector routing • Step 1: Learning about the neighbors
– The delay metric was queue length, thus it did not take line – When a router is booted, its first task is to learn who its
bandwidth into account when choosing routes. neighbors are.
– The algorithm often took too long to converge. – It accomplishes this goal by sending a special HELLO packet on
Link state routing: The idea behind link state routing is fairly each point-to-point line.
simple and can be stated as five parts. Each router must do the
following: – The router on the other end is expected to send back a reply
1. Discover its neighbors, learn their network address.
giving its name.
2. Set the distance or cost metric to each of its neighbors.
– These names must be globally unique because when a distant
3. Construct a packet containing all it has just learned.
router later hears that three routers are all connected to F, it is
4. Send this packet to and receive packets from all other routers.
essential that it can determine whether all three mean the same F.
5. Compute the shortest path to every other router.
RoutingAlgorithms: RoutingAlgorithms:
Link State routing Link State routing
When two or more routers are connected by a broadcast link (e.g., a switch, ring,
or classic Ethernet), the situation is slightly more complicated. Fig. 5-11(a) • Step 2: Setting Link Costs
illustrates a broadcast LAN to which three routers, A, C, and F, are directly
– To determine the delay is to send over the line a special
connected. Each of these routers is connected to one or more additional routers, as
shown ECHO packet that the other side is required to send back
• A better way to model the LAN
is to consider it as a node itself, immediately.
as shown in Fig. 5-11(b).
• Here, we have introduced a new, – By measuring the round-trip time and dividing it by 2, the
artificial node, N, to which A, C,
and F are connected. sending router can get a reasonable estimate of the delay.
• One designated router on the
LAN is selected to play the role – Average delay value can be better.
of N in the routing protocol.
• The fact that it is possible to go
from A to C on the LAN is
represented by the path ANC
here.
19-03-2024
RoutingAlgorithms: RoutingAlgorithms:
Link State routing Link State routing
• Steps 3: Building link state packets
• The cost to each neighbor is also given.
• An example network is presented in Fig. 5-12(a) with costs shown as labels
– Each router builds a packet containing all the data.
on the lines.
• The corresponding link state packets for all six routers are shown in Fig. 5-
– The packet starts with the identity of the sender, followed by 12(b).
a sequence number and age and a list of neighbors.
RoutingAlgorithms: RoutingAlgorithms:
Link State routing Link State routing
• Steps 4: Distributing the link state packets This algorithm has a few problems, but they are manageable.
– The fundamental idea is to use flooding to distribute the link state packets to all • First, if the sequence numbers wrap around, confusion will reign.
routers. • The solution here is to use a 32-bit sequence number. With one link
– To keep the flood in check, each packet contains a sequence number that is state packet per second, it would take 137 years to wrap around, so this
incremented for each new packet sent. possibility can be ignored.
– Routers keep track of all the (source router, sequence) pairs they see. When a • Second, if a router ever crashes, it will lose track of its sequence
new link state packet comes in, it is checked against the list of packets already number. If it starts again at 0, the next packet it sends will be rejected as
seen. a duplicate.
– If it is new, it is forwarded on all lines except the one it arrived on. If it is a • Third, if a sequence number is ever corrupted and 65,540 is received
duplicate, it is discarded. instead of 4 (a 1-bit error), packets 5 through 65,540 will be rejected as
– If a packet with a sequence number lower than the highest one seen so far ever obsolete, since the current sequence number will be thought to be
arrives, it is rejected as being obsolete as the router has more recent data. 65,540.
19-03-2024
RoutingAlgorithms:
RoutingAlgorithms:
Link State routing
Link State routing
The data structure used by router B for the network shown in Fig. 5-12(a) is depicted in
Fig. 5-13. Each row here corresponds to a recently arrived, but as yet not fully processed,
The solution to all these problems is to include the age of each link state packet. The table records where the packet originated, its sequence number and
age, and the data. In addition, there are send and acknowledgement flags for each of B’s
packet after the sequence number and decrement it once per three links (to A, C, and F, respectively). The send flags mean that the packet must be sent
on the indicated link. The acknowledgement flags mean that it must be acknowledged
second. When the age hits zero, the information from that router there.
RoutingAlgorithms: RoutingAlgorithms:
Link State routing Link State routing
• Steps 5: Computing the new routes • Link state, distance vector, and other algorithms rely on processing at all the
– Once a router has accumulated a full set of link state packets, it routers to compute routes.
• Problems with the hardware or software at even a small number of routers can
can construct the entire subnet graph because every link is
wreak havoc across the network.
represented.
• For example, if a router claims to have a link it does not have or forgets a link it
– Dijkstra’s algorithm can be run locally to construct the shortest does have, the network graph will be incorrect.
path to all possible destinations. The results of this algorithm can • If a router fails to forward packets or corrupts them while forwarding them, the
route will not work as expected.
be installed in the routing tables.
• Finally, if it runs out of memory or does the routing calculation wrong, bad
– Some applications things will happen.
• IS-IS (Intermediate System – Intermediate System) • As the network grows into the range of tens or hundreds of thousands of nodes,
the probability of some router failing occasionally becomes non negligible.
• OSPF (Open Shortest Path First)
19-03-2024
RoutingAlgorithms: RoutingAlgorithms:
Hierarchical routing Hierarchical routing
• When hierarchical routing is used, the routers are divided into what
• As networks grow in size, the router routing tables grow
we will call regions.
proportionally.
• Two level routing:Every router knows
• Not only is router memory consumed by ever-increasing tables, but – all the details about how to route packets to
more CPU time is needed to scan them and more bandwidth is destinations within its own region
needed to send status reports about them. – but knows nothing about the internal structure of other regions.
• At a certain point, the network may grow to the point where it is • Multiple-level routing: For huge networks, a two-level hierarchy
no longer feasible for every router to have an entry for every may be insufficient; it may be necessary to group the regions into
other router, so the routing will have to be done hierarchically, clusters, the clusters into zones, the zones into groups, and so on,
RoutingAlgorithms: RoutingAlgorithms:
Hierarchical routing Hierarchical routing
• When a single network becomes very large, an interesting question is
Reduction of routing tables ‘‘how many levels should the hierarchy have?’’
• For example, consider a network with 720 routers. If there is no
hierarchy, each router needs 720 routing table entries.
• If the network is partitioned into 24 regions of 30 routers each, each
router needs 30 local entries plus 23 remote entries for a total of 53
entries.
• If a three-level hierarchy is chosen, with 8 clusters each containing 9
regions of 10 routers, each router needs 10 entries for local routers, 8
entries for routing to other regions within its own cluster, and 7 entries
for distant clusters, for a total of 25 entries.
19-03-2024
RoutingAlgorithms: RoutingAlgorithms:
Hierarchical routing Broadcast routing
RoutingAlgorithms: RoutingAlgorithms:
Broadcast routing Broadcast routing
– Reverse path forwarding:
• Broadcasting: to send a packet to all destinations
simultaneously. • When a broadcast packet arrives at a router, the router checks
to see if the packet arrived on the line that is normally used for
– The source simply sends a distinct packet to every destination.
sending packets to the source of the packets.
– Flooding.
• If so, there is an excellent chance that the broadcast packet
– Multidestination routing (each packet contains either a list of
itself followed the best route from the router and is therefore
destinations or a bit map indicating the desired destinations.) (One
the first copy to arrive at the router. Then the router forwards
router pays full fare and the rest ride free.)
copies of it onto all lines except the one it arrived on.
– To make use of the sink tree for the router initiating the broadcast.
• If no, it is discarded as a duplicate.
– Reverse path forwarding.
19-03-2024
RoutingAlgorithms: RoutingAlgorithms:
Broadcast routing Multicast routing
• Multicasting : to send messages to well-defined groups that are
Reverse path forwarding.
numerically large in size but small compared to the network as whole.
(a) A subnet.
(b) a Sink tree. – Group management: Some way is needed to create and destroy
(c) The tree built by reverse path forwarding. groups, and to allow processes to join and leave groups.
• and prunes it, removing all the lines that do not lead to hosts that
are members of the group.
RoutingAlgorithms: RoutingAlgorithms:
Multicast routing Multicast routing
RoutingAlgorithms: RoutingAlgorithms:
Anycast routing Routing the mobile hosts
RoutingAlgorithms: Routing
in Ad Hoc Networks
Routing in Ad Hoc Networks: Route discovery
• Load Shedding
19-03-2024
Congestion control and flow control • Time scales of approaches to congestion control
At the other extreme, consider a network with 1-Mbps lines and 1000 large – Network provisioning: months
computers, half of which are trying to transfer files at 100 kbps to the other – Traffic-aware routing: hours
half. Here, the problem is not that of fast senders overpowering slow – Admission control: minutes
receivers, but that the total offered traffic exceeds what the network can – Traffic throttling: seconds
– Load shedding: seconds
handle.
• Similarity: Both congestion control and flow control can tell the sender
to slow down
– because the receiver cannot handle the load or
– because the network cannot handle it.
• However, sometimes it is not possible to increase capacity. • At a finer granularity, when congestion is imminent the network
• The only way then to beat back the congestion is to decrease the load. can deliver feedback to the sources whose traffic flows are
• In a virtual-circuit network, new connections can be refused if they responsible for the problem.
would cause the network to become congested. • The network can request these sources to throttle their traffic,
or it can slow down the traffic itself.
• This is called admission control.
• Finally, when all else fails, the network is forced to discard packets
that it cannot deliver.
• The general name for this is load shedding.
• A good policy for choosing which packets to discard can help to
prevent congestion collapse
packet. congestion is likely to cause choke packets to be sent to fast senders, because
they will have the most packets in the queue.
• The original packet may be tagged (a header bit is turned on) so that it
• The feedback implicit in this protocol can help prevent congestion yet not
will not generate any more choke packets farther along the path and then
throttle any sender unless it causes trouble
forwarded in the usual way.
• To avoid increasing load on the network during a time of congestion, the
router may only send choke packets at a low rate.
Quality Of Service
QUALITY OF SERVICE • Quality of service mechanisms let a network with less capacity
meet application requirements just as well at a lower cost.
• Requirements of QoS • With quality of service mechanisms, the network can honor the
• Techniques for QoS performance guarantees that it makes even when traffic spikes,
• Traffic shaping reduces congestion and thus helps the network live up to its
• We have already seen one way to limit the amount of data an
promise.
application sends: the sliding window, which uses one parameter to
• However, to make it work, there is also the issue of how the provider can
limit how much data is in transit at any given time, which indirectly
tell if the customer is following the agreement and what to do if the
limits the rate.
customer is not.
• Now we will look at a more general way to characterize traffic, with
• Packets in excess of the agreed pattern might be dropped by the network, the leaky bucket and token bucket algorithms.
or they might be marked as having lower priority.
• The formulations are slightly different but give an equivalent result.
• Monitoring a traffic flow is called traffic policing.
19-03-2024
Quality Of Service:
Traffic shaping
Quality Of Service: Packet
Scheduling
Token bucket level for • Resource reservation
shaping with rate 200 – Suppose there is a specific route for a flow, it
Mbps and capacity becomes possible to reserve resources along the route
(d) 16000 KB, to make sure the needed capacity is available.
(e) 9600 KB, and • What resources to reserve?
(f) 0KB.. – Bandwidth
– Buffer space
– CPU cycles