Unit 4
Unit 4
A host with a packet to send transmits it to the nearest router, either on its own LAN or over a point-to-point
link to the ISP. The packet is stored there until it has fully arrived and the link has finished its processing by
verifying the checksum. Then it is forwarded to the next router along the path until it reaches the destination
host, where it is delivered. This mechanism is store-and-forward packet switching.
If connectionless service is offered, packets are injected into the network individually and routed independently
of each other. No advance setup is needed. In this context, the packets are frequently called datagrams (in analogy
with telegrams) and the network is called a datagram network.
A’s table (initially) A’s table (later) C’s Table E’s Table
Let us assume for this example that the message is four times longer than the maximum packet size, so the
network layer has to break it into four packets, 1, 2, 3, and 4, and send eachof them in turn to router A.
Every router has an internal table telling it where to send packets for each of the possible destinations. Each
table entry is a pair(destination and the outgoing line). Only directly connected lines can be used.
A’s initial routing table is shown in the figure under the label ‘‘initially.’’
At A, packets 1, 2, and 3 are stored briefly, having arrived on the incoming link. Then each packet is forwarded
according to A’s table, onto the outgoing link to C within a new frame. Packet 1 is then forwarded to E and then
to F.
However, something different happens to packet 4. When it gets to A it is sent to router B, even though it is also
destined for F. For some reason (traffic jam along ACE path), A decided to send packet 4 via a different route
than that of the first three packets. Router A updated its routing table, as shown under the label ‘‘later.’’
The algorithm that manages the tables and makes the routing decisions is called the routing algorithm.
4 Implementation of connection-oriented service
If connection-oriented service is used, a path from the source router all the way to thedestination router must be
established before any data packets can be sent. This connection is called a VC (virtual circuit), and the
network is called a virtual-circuit network
When a connection is established, a route from the source machine to the destination machine is chosen as part
of the connection setup and stored in tables inside the routers. That route is used for all traffic flowing over the
connection, exactly the same way that the telephone system works. When the connection is released, the virtual
circuit is also terminated. With connection-oriented service, each packet carries an identifier telling which
virtual circuit it belongs to.
As an example, consider the situation shown in Figure. 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. Similarly, the first entry at C routes the packet to E, also with connection identifier 1.
Now let us consider what happens if H3 also wants to establish a connection to H2. It chooses connection
identifier 1 (because it is initiating the connection and this is its only connection) and tells the network to
establish the virtual circuit.
This leads to the second row in the tables. Note that we have a conflict here because although A can easily
distinguish connection 1 packets from H1 from connection 1 packets from H3, C cannot do this. For this reason,
A assigns a different connection identifier to the outgoing traffic for the second connection. Avoiding conflicts
of this kind is why routers need the ability to replace connection identifiers in outgoing packets.
In some contexts, this process is called label switching. An example of a connection-oriented network service
is MPLS (Multi Protocol Label Switching).
Regardless of whether routes are chosen independently for each packet or only when new connections are
established, certain properties are desirable in a routing algorithm correctness, simplicity, robustness,
stability, fairness, optimality
Routing algorithms can be grouped into two major classes:
1) nonadaptive (Static Routing)
2) adaptive. (Dynamic Routing)
Nonadaptive algorithm 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 is computed in advance, off line, and
downloaded to the routers when the network is booted. This procedure is sometimes called static routing.
Adaptive algorithm, in contrast, change their routing decisions to reflect changes in the topology, and
usually the traffic as well.
Adaptive algorithms differ in
1) Where they get their information (e.g., locally, from adjacent routers, or from all routers),
2) When they change the routes (e.g., every ∆T sec, when the load changes or when thetopology changes), and
3) What metric is used for optimization (e.g., distance, number of hops, or estimated transittime).
This procedure is called dynamic routing
Flooding
• Another static algorithm is flooding, in which every incoming packet is sent out on every outgoing line
except the one it arrived on.
• Flooding obviously generates vast numbers of duplicate packets, in fact, an infinite number unless some
measures are taken to damp the process.
• One such measure is to have a hop counter contained in the header of each packet, which is decremented at
each hop, with the packet being discarded when the counter reaches zero. Ideally, the hop counter should be
initialized to the length of the path from source to destination.
• A variation of flooding that is slightly more practical is selective flooding. In this algorithm the routers do
not send every incoming packet out on every line, only on those lines that are going approximately in the
right direction.
• Flooding is not practical in most applications.
Routing between autonomous systems is referred to as inter domain routing. (PATH VECTOR) Each autonomous
system can choose one or more intra domain routing protocols to handle routing inside the autonomous
system. However, only one inter domain routing protocolhandles routing between autonomous systems.
In distance vector routing, the least-cost route between any two nodes is the route with minimum distance. In
this protocol, as the name implies, each node maintains a vector (table) of minimum distances to every node.
Initialization
Sharing
Updating
Initialization
Each node can know only the distance between itself and its immediate neighbors, those directly connected to
it. So for the moment, we assume that each node can send a message to the immediate neighbors and find the
distance between itself and these neighbors. Below fig shows the initial tables for each node. The distance for
any entry that is not a neighbor is marked as infinite (unreachable).
Sharing
The whole idea of distance vector routing is the sharing of information between neighbors. Although node A
does not know about node E, node C does. So if node C shares its routing table with A, node A can also know
how to reach node E. On the other hand, node C does not know how to reach node D, but node A does. If node
A shares its routing table with node C, node C also knows how to reach node D. In other words, nodes A and C,
as immediate neighbors, can improve their routing tables if they help each other.
NOTE: In distance vector routing, each node shares its routing table with its immediate neighbors periodically
and when there is a change
Updating
When a node receives a two-column table from a neighbor, it needs to update its routingtable. Updating takes
three steps:
1. The receiving node needs to add the cost between itself and the sending node to each value in the second
column. (x+y)
2. If the receiving node uses information from any row. The sending node is the next node inthe route.
3. The receiving node needs to compare each row of its old table with the corresponding row of the modified
version of the received table.
a. If the next-node entry is different, the receiving node chooses the row with thesmaller cost. If
there is a tie, the old one is kept.
b. If the next-node entry is the same, the receiving node chooses the new row.
For example, suppose node C has previously advertised a route to node X with distance 3. Suppose that now
there is no path between C and X; node C now advertises this route with a distance of infinity. Node A must not
ignore this value even though its old entry is smaller. The old route does not exist anymore. The new route has a
distance of infinity.
Updating in distance vector routing
Final Diagram
When to Share
The question now is, When does a node send its partial routing table (only two columns) to all its immediate
neighbors? The table is sent both periodically and when there is a change in thetable.
Periodic Update A node sends its routing table, normally every 30 s, in a periodic update. The period depends
on the protocol that is using distance vector routing.
Triggered Update A node sends its two-column routing table to its neighbors anytime there is a change in its
routing table. This is called a triggered update. The change can result from the following.
1. A node receives a table from a neighbor, resulting in changes in its own table after updating.
2. A node detects some failure in the neighboring links which results in a distance change toinfinity.
Two-node instability
Three-node instability
2. Split Horizon: In this strategy, instead of flooding the table through each interface, each node sends only
part of its table through each interface. If, according to its table, node B thinks that the optimum route to
reach X is via A, it does not need to advertise this piece of information to A; the information has come from
A (A already knows). Taking information from node A, modifying it, and sending it back to node A creates
the confusion. In our scenario, node B eliminates the last line of its routing table before it sends it to A. In
this case, node A keeps the value of infinity as the distance to X. Later when node A sends its routing table
to B, node B also corrects its routing table. The system becomes stable after the first update: both node A
and B know that X is not reachable.
3. Split Horizon and Poison Reverse Using the split horizon strategy has one drawback. Normally, the
distance vector protocol uses a timer, and if there is no news about a route, the node deletes the route from
its table. When node B in the previous scenario eliminates the route to X from its advertisement to A, node
A cannot guess that this is due to the split horizon strategy (the source of information was A) or because B
has not received any news about X recently. The split horizon strategy can be combined with the poison
reverse strategy. Node B can still advertise the value for X, but if the source of information is A, it can
replace the distance with infinity as a warning: "Do not use this value; what I know about this route comes
from you."
I. Creation of Link State Packet (LSP) A link state packet can carry a large amount of information. For the
moment, we assume that it carries a minimum amount of data: the node identity, the list of links, a sequence
number, and age. The first two, node identity and the list of links, are needed to make the topology. The
third, sequence number, facilitates flooding and distinguishes new LSPs from old ones. The fourth, age,
prevents old LSPs from remaining in the domain for a long time.
LSPs are generated on two occasions:
1. When there is a change in the topology of the domain
2. on a periodic basis: The period in this case is much longer compared to distance vector. The timer set for
periodic dissemination is normally in the range of 60 min or 2 h based on the implementation. A longer
period ensures that flooding does not create too much trafficon the network.
II. Flooding of LSPs: After a node has prepared an LSP, it must be disseminated to all other nodes, not
only to its neighbors. The process is called flooding and based on the following
1. The creating node sends a copy of the LSP out of each interface
2. A node that receives an LSP compares it with the copy it may already have. If the newly arrived
LSP is older than the one it has (found by checking the sequence number), it discards the LSP. If it is
newer, the node does the following:
a. It discards the old LSP and keeps the new one.
b. It sends a copy of it out of each interface except the one from which the packet arrived. This
guarantees that flooding stops somewhere in the domain (where a node has only one interface).
III. Formation of Shortest Path Tree: Dijkstra Algorithm
A shortest path tree is a tree in which the path between the root and every other node is the shortest.
The Dijkstra algorithm creates a shortest path tree from a graph. The algorithm divides the nodes into two sets:
tentative and permanent. It finds the neighbors of a current node, makesthem tentative, examines them, and if
they pass the criteria, makes them permanent.
I. Calculation of a routing table
routing table for node A
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.
At a certain point, the network may grow to the point where it is no longer feasible for every router to have an
entry for every other router, so the routing will have to be done hierarchically, as it is in the telephone network.
When hierarchical routing is used, the routers are divided into what we will call regions. 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 outof names for aggregations
When a single network becomes very large, an interesting question is ‘‘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
Kamoun and Kleinrock (1979) discovered that the optimal number of levels for an N router network is ln N,
requiring a total of e ln N entries per router
Above Figure depicts the onset of congestion. When the number of packets hosts send into the network is well
within its carrying capacity, the number delivered is proportional to the number sent. If twice as many are sent,
twice as many are delivered. However, as the offered load approaches the carrying capacity, bursts of traffic
occasionally fill up the buffers inside routers and some packets are lost. These lost packets consume some of the
capacity, so the number of delivered packets falls below the ideal curve. The network is now congested. Unless
the network is well designed, it may experience a congestion collapse
The reason congestion control and flow control are often confused is that the best way to handle both problems
is to get the host to slow down. Thus, a host can get a ‘‘slow down’’ message either because the receiver cannot
handle the load or because the network cannot handle it.
Choke Packets
1. A more direct way of telling the source to slow down.
2. A choke packet is a control packet generated at a congested node and transmitted to restrict traffic
flow.
3. The source, on receiving the choke packet must reduce its transmission rate by a certainpercentage.
4. An example of a choke packet is the ICMP Source Quench Packet. Hop-by-
Hop Choke Packets
1. Over long distances or at high speeds choke packets are not very effective.
2. A more efficient method is to send to choke packets hop-by-hop.
3. This requires each hop to reduce its transmission even before the choke packet arrive atthe source
Load Shedding
1. When buffers become full, routers simply discard packets.
2. Which packet is chosen to be the victim depends on the application and on the errorstrategy used in
the data link layer.
3. For a file transfer, for, e.g. cannot discard older packets since this will cause a gap in thereceived data.
4. For real-time voice or video it is probably better to throw away old data and keep newpackets.
5. Get the application to mark packets with discard priority.
The Leaky Bucket Algorithm used to control rate in a network. It is implemented as a single- server queue
with constant service time. If the bucket (buffer) overflows then packets are discarded.
(a) A leaky bucket with water. (b) a leaky bucket with packets.
1. The leaky bucket enforces a constant output rate (average rate) regardless of the burstiness of the input.
Does nothing when input is idle.
2. The host injects one packet per clock tick onto the network. This results in a uniform flow of packets,
smoothing out bursts and reducing congestion.
3. When packets are the same size (as in ATM cells), the one packet per tick is okay. For variable length
packets though, it is better to allow a fixed number of bytes per tick. E.g. 1024 bytes per tick will allow one
1024-byte packet or two 512-byte packets or four 256- byte packets on 1 tick
1. In contrast to the LB, the Token Bucket Algorithm, allows the output rate to vary,depending on
the size of the burst.
2. In the TB algorithm, the bucket holds tokens. To transmit a packet, the host must captureand destroy one
token.
3. Tokens are generated by a clock at the rate of one token every t sec.
4. Idle hosts can capture and save up tokens (up to the max. size of the bucket) in order to send larger
bursts later.
(a) Before. (b) After.