CN Unit 2 Slides
CN Unit 2 Slides
CN Unit 2 Slides
• One camp argues that the routers job is moving packets around.
• Other camp argues that the subnet should provide a reliable, connection oriented
service.
Implementation of Connectionless Service
• If connectionless service is offered, packets are injected into the subnet individually &
routed independently of each other.
• Advance setup not required.
• Packets are called datagrams, subnet is called datagram subnet.
• Virtual circuit – A path from source router to destination router.(virtual circuit
subnet).
• Suppose that the process P1 has a long message for P2. It hands the message to the
transport layer, with instructions to deliver it to process P2 on host H2.
• The algorithm that manages the tables and makes the routing decisions is called the
routing algorithm.
Implementation of Connection-Oriented Service
• With connection-oriented service, each packet carries an identifier telling which
virtual circuit it belongs to.
• Here, host H1 has established connection 1 with host H2. This connection is
remembered as the first entry in each of the routing tables.
• The first line of A’s table says that if a packet bearing connection identifier 1 comes in
from H1, it is to be sent to router C and given connection identifier 1.
• If H3 also wants to establish connection to H2, it choses connection identifier 1.
• This leads to conflict here because although A can easily distinguish 1 packets from
H1 from connection 1 packets from H3, C cannot do this.
• So A assigns a different connection identifier for outgoing traffic for second
connection as 2 – Label Switching
Comparison of Virtual-Circuit and Datagram
Subnets
Quality of Service
• 4 primary parameters: reliability, delay, jitter and bandwidth together these
determine QoS.
• A stream of packets from a source to a destination is called a flow.
• File transfer applications, including e-mail & video are not delay sensitive.
• Interactive applications, such as Web surfing & remote login, are more delay
sensitive.
• Real-time applications, such as telephony & videoconferencing have strict delay
requirements.
• ATM networks classify flows in 4 categories with respect to their QoS demands as
follows:
1. Constant bit rate (e.g., telephony).
2. Real-time variable bit rate (e.g., compressed videoconferencing).
3. Non-real-time variable bit rate (e.g., watching a movie on demand).
4. Available bit rate (e.g., file transfer).
Techniques for achieving good quality of service
• Overprovisioning
• Buffering
• Traffic Shaping
• Leaky Bucket algorithm
• Token Bucket algorithm
• Resource Reservation
• Admission Control
• Proportional Routing
• Packet Scheduling
Overprovisioning
• An easy solution is to provide so much router capacity, buffer space, and bandwidth that
the packets just fly through easily. To some extent, telephone system is overprovisioned.
Buffering
• Flows can be buffered on the receiving side before being delivered.
Traffic Shaping
• Nonuniform output is common if the server is handling many streams at once, & it
also allows other actions, such as fast forward and rewind, user authentication & so
on.
• Traffic shaping smooths out the traffic on the server side, rather than on the client
side.
• When a connection is setup, the user & the subnet agree on a certain traffic pattern for
that circuit – Service Level Agreement.
• Traffic shaping reduces congestion & thus helps the carrier live up to its promise.
• Monitoring a traffic flow is called traffic policing.
Leaky Bucket Algorithm
I K
I J K
Sink Tree
• As a direct consequence of the optimality principle, we can see that the set of optimal
routes from all sources to a given destination form a tree rooted at the destination.
Such a tree is called a sink tree.
Shortest Path Routing
• The idea is to build a graph of the network, with each node of the graph representing a
router and each edge of the graph representing a communication line, or link. To
choose a route between a given pair of routers, the algorithm just finds the shortest
path between them on the graph.
• One way of measuring path length is the number of hops.
• In the general case, the labels on the edges could be computed as a function of the
distance, bandwidth, average traffic, communication cost, measured delay, and other
factors.
• Each node is labeled (in parentheses) with its distance from the source node along the
best known path.
• The distances must be non-negative, as they will be if they are based on real
quantities like bandwidth and delay.
• Initially, no paths are known, so all nodes are labeled with infinity. As the algorithm
proceeds and paths are found, the labels may change, reflecting better paths.
Flooding
• Every incoming packet is sent out on every outgoing line except the one it arrived
on – Flooding.
• Hop counter is used to decrement at each hop, it is present in header of each packet
with the packet being discarded when the counter reaches zero.
• Alternative technique is to keep track of which packets have been flooded, to avoid
sending them out a second time.
• Selective flooding
1 1
A B C
A B C
Link State Routing
• The idea behind link state routing is fairly simple and can be stated as five parts. Each
router must do the following things to make it work:
1. Discover its neighbors and learn their network addresses.
2. Set the distance or cost metric to each of its neighbors.
3. Construct a packet telling all it has just learned.
4. Send this packet to and receive packets from all other routers.
5. Compute the shortest path to every other router.
Learning about the Neighbours
• When a router is booted, to learn about its neighbours it sends a HELLO packet on each
point-to-point line.
• When two or more routers are connected by
a broadcast link, the situation is slightly
more complicated. Fig. 5-11(a) illustrates a
broadcast LAN to which three routers, A, C,
and F, are directly connected.
• Each of these routers is connected to one or
more additional routers, as shown.
• A better way to model the LAN is to
consider it as a node itself, as shown in Fig.
5-11(b).
• Here, we have introduced a new, artificial
node, N, to which A, C, and F are connected.
• One designated router on the LAN is
selected to play the role of N in the routing
protocol.
Measuring Line Cost
• The most direct way to determine the delay (delay to each of neighbors of a router) is
to send over the line a special ECHO packet that the other side is required to send
back immediately.
• The link state routing
algorithm requires each
link to have a distance or
cost metric for finding
shortest paths.
• The cost to reach
neighbours can be set
automatically, or
configured by the network
operator. A common
choice is to make the cost
inversely proportional to
the bandwidth of the link.
Building Link State Packets
• Once the information needed for the exchange has been collected, the next step is for
each router to build a packet containing all the data.
• The packet starts with the identity of the sender, followed by a sequence number and a
list of neighbours.
Distributing the Link State Packets
• The trickiest part of the algorithm is distributing the link state packets.
• The fundamental idea is to use flooding to distribute the link state packets to all routers.
• To keep the flood in check, each packet contains a sequence number that is incremented
for each new packet sent. Routers keep track of all the (source router, sequence) pairs
they see.
• When a new link state packet comes in, it is checked against the list of packets already
seen. If it is new, it is forwarded on all lines except the one it arrived on. If it is a
duplicate, it is discarded.
• The solution to all distribution related problems is to include the age of each packet after
the sequence number and decrement it once per second.
• When the age hits zero, the information from that router is discarded.
Computing the New Routes
• Once a router has accumulated a full set of link state packets, it can construct the
entire network graph because every link is represented.
• Link state routing is widely used in actual networks, so a few words about some
example protocols are in order.
• Many ISPs use the IS-IS (Intermediate System-Intermediate System) and OSPF
(Open Shortest Path First).
Hierarchical Routing
• As networks grow in size, the router routing tables grow proportionally.
• Not only is router memory consumed by ever-increasing tables, but more CPU time is
needed to scan them and more bandwidth is needed to send status reports about them.
• When hierarchical routing is used, the routers are divided into what we will call
regions.(Divide & Conquer)
• Each router knows all the details about how to route packets to destinations within its
own region but knows nothing about the internal structure of other regions.
• For huge networks, a two-level hierarchy may be insufficient; it may be necessary to
group the regions into clusters, the clusters into zones, the zones into groups, and so
on, until we run out of names for aggregations.
Broadcast Routing
• In some applications, hosts need to send messages to many or all other hosts.
• Ex: A service distributing weather reports, stock market updates, or live radio
programs might work best by sending to all machines and letting those that are
interested read the data.
• Sending a packet to all destinations simultaneously is called broadcasting.
• Broadcasting method results in storing the destination address and waste of
bandwidth.
• Multidestination or Broadcast can be improved by storing destinations or a bit map in
each packet.
Other ideal way using is reverse path forwarding which works as below
• When a broadcast packet arrives at a router, the router checks to see if the packet
arrived on the link that is normally used for sending packets toward the source of the
broadcast.
• If the packet is broadcast packet, there is an excellent chance that the broadcast packet
itself followed the best route from the router and is therefore the first copy to arrive at
the router.
• This being the case, the router forwards copies of it onto all links except the one it
arrived on.
• If, however, the broadcast packet arrived on a link other than the preferred one for
reaching the source, the packet is discarded as a likely duplicate.
One more way of improving reverse path forwarding is spanning tree which acts
as follows.
• A spanning tree is a subset of the network that includes all the routers but contains no
loops. Sink trees are spanning trees.
• If each router knows which of its lines belong to the spanning tree, it can copy an
incoming broadcast packet onto all the spanning tree lines except the one it arrived
on.
Multicast Routing
• We need a way to send messages to well-defined groups that are numerically large in
size but small compared to the network as a whole.
• Multicasting requires group management.
(Multicast routing is a networking method for efficient distribution of one-to-many
traffic. A multicast source, such as a live video conference, sends traffic in one stream
to a multicast group. The multicast group contains receivers such as computers, devices,
and IP phones.)
• Core-based trees are used, here a single spanning tree per group is computed, with
the root near the middle of the group.
• As an example, consider the two groups, 1 and 2, in the network shown in Fig. 5-
17(a).
• Some routers are attached to hosts that belong to one or both of these groups, as
indicated in the figure. A spanning tree for the leftmost router is shown in Fig. 5-
17(b).
• When a process sends a multicast packet to a group, the first router examines its
spanning tree & prunes it, removing all lines that do not lead to hosts that are
members of the group.
• In fig (c), we can see the pruned spanning tree for group 1, fig (d), shows the pruned
spanning tree for group 2.
• Multicast packets are forwarded only along the appropriate spanning tree.
• Simplest way of pruning can be used if link state routing is used & each router is
aware of the complete topology, including which hosts belong to which group.
• With distance vector routing, a different pruning strategy can be followed.
Routing for Mobile Hosts
• The term mobile hosts refer to moving host they are distinct from stationary hosts that
never move.
• The basic idea used for mobile routing in the Internet and cellular networks is for the
mobile host to tell a host at the home location where it is now.
• Hosts away from home & still want to be connected – Mobile Hosts
• Permanent address of all hosts – Home location
• Agents which are processes that keep track of all mobile hosts visiting the area –
Foreign Agents.
• Agent keeps track of hosts whose home is in the area, but who are currently visiting
another area – Home Agent.
Registration procedure, when a new host enters an area:
1. Periodically, each foreign agent broadcasts a packet announcing its existence and
address. A newly-arrived mobile host may wait for one of these messages, but if
none arrives quickly enough, the mobile host can broadcast a packet saying: Are
there any foreign agents around?
2. The mobile host registers with the foreign agent, giving its homeaddress, current
data link layer address, and some security information.
3. The foreign agent contacts the mobile host's home agent and says: One of your
hosts is over here. The message from the foreign agent to the home agent contains
the foreign agent's network address. It also includes the security information to
convince the home agent that the mobile host is really there.
4. The home agent examines the security information, which contains a timestamp, to
prove that it was generated within the past few seconds. If it is happy, it tells the
foreign agent to proceed.
5. When the foreign agent gets the acknowledgement from the home agent, it makes
an entry in its tables and informs the mobile host that it is now registered.
The mobile communication happens as below
Step 1
• Once the mobile host has care of address, it can tell its home agent where it is now. It
does this by sending a registration message to the home agent with the care of
address. The message is shown with a dashed line in below figure to indicate that it is
a control message, not a data message.
Step 2
• After the step1 the sender sends a data packet to the mobile host using its permanent
address. This packet is routed by the network to the host‘s home location because that
is where the home address belongs. In permanent location the home agent intercepts
this packet because the mobile host is away from home.
Step3
• The home agent wraps or encapsulates the packet with a new header and sends this
bundle to the care of address and this mechanism is called tunneling.
Step4
• When the encapsulated packet arrives at the care of address, the mobile host unwraps
it and retrieves the packet from the sender. The mobile host then sends its reply
packet directly to the sender (step 4) and this overall route is called triangle routing
because it may be circuitous if the remote location is far from the home location.
Step5
• From step 4, the sender may learn the current care of address. Subsequent packets can
be routed directly to the mobile host by tunneling them to the care of address
bypassing the home location entirely. If connectivity is lost for any reason as the
mobile moves, the home address can always be used to reach the mobile.
Routing in Ad Hoc Networks
• Consider scenario where routers themselves are mobile and these possibilities are
emergency workers at an earthquake site, military vehicles on a battlefield, a fleet of
ships at sea, or a gathering of people with laptop computers.
• In all above cases, and others, each node communicates wirelessly and acts as both a
host and a router.
• Networks of nodes that just happen to be near each other are called ad hoc networks
or MANETs (Mobile Ad hoc NETworks).
• A mobile ad hoc network (MANET) is a continuously self-configuring, self-
organizing, infrastructure-less network of mobile devices connected without wires.
• It is sometimes known as "on-the-fly" networks or "spontaneous networks".
• AODV (Ad hoc On-demand Distance Vector) It is a relative of the distance vector
algorithm that has been adapted to work in a mobile
Route Discovery
• In AODV, routes to a destination are discovered on demand, that is, only when a somebody
wants to send a packet to that destination.
• This saves much work that would otherwise be wasted when the topology changes before the
route is used.
• At any instant, the topology of an ad hoc network can be described by a graph of connected
nodes.
• Two nodes are connected (i.e., have an arc between them in the graph) if they can
communicate directly using their radios.
• Consider the newly formed ad hoc network of figure and scenario is that a process at node A
wants to send a packet to node I.
• The AODV algorithm maintains a distance vector table at each node, keyed by destination,
giving information about that destination, including the neighbour to which to send packets to
reach the destination.
First, A looks in its table and does not find an entry for I and It now has to
discover a route to I. This property of discovering routes only when they are
needed is what makes this algorithm on demand.
Route Maintenance
• Because nodes can move or be switched off, the topology can change spontaneously. The
algorithm needs to be able to deal with this. Periodically, each node broadcasts a Hello
message.
• Each of its neighbours is expected to respond to it, If no response is forthcoming, the
broadcaster knows that that neighbour has moved out of range or failed and is no longer
connected to it.
• Similarly, if it tries to send a packet to a neighbour that does not respond, it learns that the
neighbour is no longer available. This information is used to purge(cleaning) routes that no
longer work.
• For each possible destination, each node, N, keeps track of its active neighbours that have
fed it a packet for that destination during the last ΔT seconds.
• When any of N‘s neighbours becomes unreachable, it checks its routing table to see which
destinations have routes using the now-gone neighbour.
• For each of these routes, the active neighbours are informed that their route via N is now
invalid and must be purged from their routing tables.
• For route maintenance the invalid routes have been purged from the network,
and senders can find new, valid routes by using the discovery mechanism that
we discussed above.
• To ensure rapid convergence, routes include a sequence number that is
controlled by the destination.
• The destination sequence number is like a logical clock.
• The destination increments it every time that it sends a fresh ROUTE REPLY.
• Senders ask for a fresh route by including in the ROUTE REQUEST the
destination sequence number of the last route they used, which will either be
the sequence number of the route that was just purged, or 0 as an initial value.
Routing Algorithms
• Optimality Principle
• Shortest Path Routing
• Flooding
• Distance Vector Routing
• Link State Routing – Learning about the neighbors, Building link state Packets,
Distributing the Link State Packets, Computing New Routes.
• Hierarchical Routing
• Broadcast Routing
• Multicast Routing
• Routing for Mobile Hosts
• Routing in Ad Hoc Networks - Route Discovery, Route Maintenance
Congestion Control Algorithms
• Too many packets present in the network cause packet delay and loss that degrades
performance and this situation is called congestion.
• The network and transport layers share the responsibility for handling congestion.
• Since congestion occurs within the network, it is the network layer that directly
experiences it and must ultimately determine what to do with the excess packets.
• However, the most effective way to control congestion is to reduce the load that the
transport layer is placing on the network so this requires the network and transport
layers to work together.
• Below diagram illustrate the concept of congestion by taking good put (rate at which
useful packets got delivered) in y axis and offered load on x axis.
General Principles of Congestion Control
• Computer networks can be viewed from control theory point, approach leads to
dividing solutions into 2 groups.
*Open loop
*Closed loop
• Open loop solutions attempt to solve the problem by good design. Tools include
deciding when to accept new traffic, deciding when to discard packets & which ones,
& making scheduling decisions at various points in the network.
• Closed loop solutions are based on feedback loop, approach has 3 parts:
1. Monitor the system to detect when & where congestion occurs.
2. Pass this information to places where actions can be taken.
3. Adjust system operation to correct the problem.
• Variety of metrics can be used to monitor subnet, percentage of all packets discarded
for lack of buffer space, the average queue lengths, the number of packets that time out
are retransmitted, the average packets delay, and the standard deviation of packet delay.
Choke Packets
• The router sends a choke packet back to the source host, giving it the destination
found in the packet. The original packet is tagged so that it will not generate any more
choke packets farther along the path & is then forwarded in the usual way.
• When the host gets the choke packet, it is required to reduce the traffic sent to the
specified destination by X percent.
• Several variations on this congestion control algorithm have been proposed. For one,
the routers can maintain several thresholds.
• Another variation is to use queue lengths or buffer utilization instead of line
utilization as the trigger signal.
Hop-by-Hop Choke Packets
• At high speeds or over long distances, many new packets may be transmitted after
congestion has been signalled because of the delay before the signal takes effect.
• To reduce the hop pressure there is buffer provided for the storage of packet at each
host.
• If a host signal the congestion by sending choke packet, the source host need to put
packets in a pipeline until the congestion comes down.
• The net effect of this hop-by-hop scheme is to provide quick relief at the point of
congestion, at the price of using up more buffers upstream. In this way, congestion
can be nipped in the bud without losing any packets.
Load Shedding
• Load shedding is a fancy way of saying that when routers are being overloaded by packets that they
cannot handle, they just throw them away.
• For a file transfer, an old packet is worth more than a new one.
• In contrast, for real-time media, a new packet is worth more than an old one.
• The former policy (old is better than new) is often called wine and the latter (new is better than old)
is often called milk because most people would rather drink new milk and old wine than the
alternative.
• More intelligent load shedding requires cooperation from the senders.
• An example is packets that carry routing information are more important than data packets.
• To implement an intelligent discard policy, applications must mark their packets to indicate to the
network how important they are. then, when packets have to be discarded, routers can first drop
packets from the least important class, then the next most important class, and so on.
• Of course, unless there is some significant incentive to mark packets as anything other than VERY
IMPORTANT—NEVER, EVER DISCARD, nobody will do it, many times discarding of packets
are done as per the need to service.
Random Early Detection (RED)
It is well known that dealing with congestion after it is first detected is more
effective than letting it gum up the works and then trying to deal with it. This
observation leads to the idea of discarding packets before all the buffer space is really
exhausted. A popular algorithm for doing this is RED.
To determine when to start discarding, routers maintain a running average of their
queue lengths. When the average queue length on some line exceeds a threshold, the
line is said to be congested and action is taken.
Jitter Control
• The variation in the packet arrival times is called jitter.
• The jitter can be bounded by computing the expected transit time for each hop along
the path.
• When the packet arrives at a router, the router checks to see how much the packet is
behind or ahead of its schedule. This information is stored in the packet and updated
at each hop.
• If the packet is ahead of schedule, it is held just long enough to get it back to
schedule.
• If it is behind schedule, the router tries to get it out the door quickly.
• In fact, the algorithm for determining which of several packets competing for an
output line should go next can always choose the packet furthest behind in its
schedule.
Token Bucket Algorithm
• For many applications , it is better to allow the
output to speed up somewhat when large bursts
arrive, so a more flexible algorithm is needed,
preferably that never loses data. One such
algorithm is Token Bucket Algorithm.
• In figure(a), a bucket is holding 3 tokens, with 5
packets waiting to be transmitted. For a packet to
be transmitted, it must capture & destroy one
token.
• In figure(b), 3 of the 5 packets have gotten
through, but the other 2 are stuck waiting for 2
more token to be generated.
• The implementation of the basic token bucket
algorithm is just a variable that counts tokens.
• The counter is incremented by one every ΔT &
decremented by one whenever a packet is sent.
• When the counter hits zero, no packets may be
sent.
Resource Reservation
• 3 different kinds of resources can be potentially reserved: bandwidth, buffer space,
CPU cycles.
• Bandwidth : If a flow requires 1 Mbps & the outgoing line has a capacity of 2Mbps,
trying to direct three flows through that line is not going to work. Thus reserving
bandwidth means not oversubscribing any output line.
• Buffer Space : When a packet arrives, it is usually deposited on the network interface
card by the hardware itself. For good quality of service, so buffers can be reserved for
a specific flow so that flow does not have to compete for buffers with other flows.
• CPU cycles : It takes router CPU time to process a packet, so a router can process
only a certain number of packets per second. Making sure that the CPU is not
overloaded is needed to ensure timely processing of each packet.
Admission Control
• When the well shaped traffic flow is offered from router, it has to decide, based on its
capacity & how many commitments it has already made for other flows, whether to
admit or reject the flow.
• Flows must be described accurately in terms of specific parameters that can be
negotiated. Such parameters are called flow specification.
Proportional Routing
• A different approach that has been proposed to
provide a higher QoS is to split the traffic for each
destination over multiple paths.
• Since routers generally do not have a complete
overview of network-wide traffic, the only feasible
way to split traffic over multiple routes is to use
locally-available information.
• A simple method is to divide the traffic equally or in
proportion to the capacity of the outgoing links.
Packet Scheduling
• Fair queueing algorithm: The essence of the algorithm is that routers have separate
queues for each output line, one for each flow.
• Weighted fair queueing