Professional Documents
Culture Documents
Unit - III
Design Issues
Store-and-Forward Packet Switching:
packet is stored 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
Design Issues
Services Provided to the Transport
Layer:
Goals:
The services should be independent of the
router technology
The transport layer should be shielded from the
number, type, and topology of the routers
present
The network addresses made available to the
transport layer should use a uniform numbering
plan, even across LANs and WANs
Design Issues
(Argue1): moving packets around and
nothing else
Therefore, the hosts should accept this fact and
do error control (i.e., error detection and
correction) and flow control themselves
(end-to-end argument)
Design Issues
Implementation of Connectionless Service:
If connectionless service is offered, packets are
injected into the network individually and
routed independently of each other.
packets are frequently called datagrams and
the network is called a datagram network
If connection-oriented service is used, a path
from the source router all the way to the
destination router must be established before
any data packets can be sent. This connection
is called a VC (virtual circuit)
Design Issues
algorithm that manages the tables and makes the
routing decisions is called the routing algorithm
Design Issues
Implementation of Connection-Oriented
Service
idea behind virtual circuits is to avoid having to
choose a new route for every packet sent
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
each packet carries an identifier telling which
virtual circuit it belongs to.
Design Issues
process is called label switching
example of a connection-oriented network service
is MPLS (MultiProtocol Label Switching).
Design Issues
Routing Algorithms
Unit - III
Routing Algorithm
Routing Algorithm: part of the network layer software responsible
for deciding which output line an incoming packet should be
transmitted on
Session routing: data packets just follow the already established
route; a route remains in force for an entire session
Forwarding: handles each packet as it arrives, looking up the
outgoing line to use for it in the routing tables
Properties that are desirable in a routing algorithm:
correctness, simplicity, robustness, stability, fairness, and
efficiency
Routing algorithms can be grouped into two major classes:
nonadaptive and adaptive.
Routing Algorithm
Nonadaptive algorithms:
do not base their routing decisions on any measurements or
estimates of the current topology and traffic
Choice of the route to use to get from I to J (for all I and J) is
computed in advance, offline, and downloaded to the routers when
the network is booted (also know as static routing)
Adaptive algorithms:
change their routing decisions to reflect changes in the topology,
and sometimes changes in the traffic
dynamic routing algorithms differ in
where they get their information (e.g., locally, from adjacent
routers, or from all routers),
when they change the routes (e.g., when the topology changes, or
every T seconds as the load changes), and
what metric is used for optimization (e.g., distance, number of
hops, or estimated transit time).
Routing Algorithm
optimality principle: a general statement about optimal
routes without regard to network topology or traffic
Allowing all of the possible paths to be chosen, the tree
becomes a more general structure called a DAG (Directed
Acyclic Graph) and DAGs have no loops.
(a) A network.
Dijkstra:
1. Assign to every node a tentative distance value: set it to zero for our initial node and to
infinity for all other nodes.
2. Mark all nodes unvisited. Set the initial node as current. Create a set of the unvisited
nodes called the unvisited set consisting of all the nodes.
3. For the current node, consider all of its unvisited neighbors and calculate
their tentative distances. Compare the newly calculated tentative distance to the current
assigned value and assign the smaller one. For example, if the current node A is marked
with a distance of 6, and the edge connecting it with a neighbor B has length 2, then the
distance to B (through A) will be 6 + 2 = 8. If B was previously marked with a distance
greater than 8 then change it to 8. Otherwise, keep the current value.
4. When we are done considering all of the neighbors of the current node, mark the
current node as visited and remove it from the unvisited set. A visited node will never be
checked again.
5. If the destination node has been marked visited (when planning a route between two
specific nodes) or if the smallest tentative distance among the nodes in the unvisited
set is infinity (when planning a complete traversal; occurs when there is no connection
between the initial node and remaining unvisited nodes), then stop. The algorithm has
finished.
6. Select the unvisited node that is marked with the smallest tentative distance, and set it
as the new "current node" then go back to step 3.
Source: Wikipedia
Dijkstras Algorithm
#define MAX NODES 1024 /* maximum number of nodes
*/
#define INFINITY 1000000000 /* a number larger than
every maximum path */
int n, dist[MAX NODES][MAX NODES]; /* dist[i][j] is
the distance from i to j */
void shortest path(int s, int t, int path[])
{
struct state { /* the path being worked on */
int predecessor; /* previous node */
int length; /* length from source to this node */
enum {permanent, tentative} label; /* label state
*/
} state[MAX NODES];
Dijkstras Algorithm
int i, k, min;
struct state *p;
for (p = &state[0]; p < &state[n]; p++) { /*
initialize state */
p->predecessor = 1;
p->length = INFINITY;
p->label = tentative;
}
state[t].length = 0; state[t].label = permanent;
k = t; /* k is the initial working node */
do { /* Is there a better path from k? */
for (i = 0; i < n; i++) /* this graph has n nodes */
if (dist[k][i] != 0 && state[i].label == tentative) {
if (state[k].length + dist[k][i] < state[i].length) {
state[i].predecessor = k;
state[i].length = state[k].length + dist[k][i];
}
}
Dijkstras Algorithm
/* Find the tentatively labeled node with the
smallest label. */
k = 0; min = INFINITY;
for (i = 0; i < n; i++)
if (state[i].label == tentative && state[i].length <
min) {
min = state[i].length;
k = i;
}
state[k].label = permanent;
} while (k != s);
/* Copy the path into the output array. */
i = 0; k = s;
do {path[i++] = k; k = state[k].predecessor; } while
(k >= 0);
}
Flooding
Each router must make decisions based on local
knowledge, not the complete picture of the network
Flooding: every incoming packet is sent out on
every outgoing line except the one it arrived on
One measure is to have a hop counter
hop counter should be initialized to the length of the
path from source to destination and decremented
If the sender does not know how long the path is, it
can initialize the counter to the worst case
Routers keep track of which packets have been
flooded, to avoid sending them out a second time
source router put a sequence number in each packet
Flooding
Flooding is not practical, but it does have some
important uses:
it ensures that a packet is delivered to every node
wasteful if there is a single destination but effective
for broadcasting information
tremendously robust
routers only need to know their neighbors
Flooding can also be used as a metric against which
other routing algorithms can be compared
Flooding always chooses the shortest path because
it chooses every possible path in parallel
(a) Nine routers and a broadcast LAN. (b) A graph model of (a).
(a) A network. (b) The link state packets for this network
Hierarchical Routing
Routers are divided into Regions
Router knows how to route packets within its own region
but knows nothing about other regions
For huge networks, a two-level hierarchy may be
insufficient
group the regions into clusters, the clusters into zones, the
zones into groups, and so on
Hierarchical Routing
Broadcast Routing
Sending a packet to all destinations simultaneously is called
broadcasting
source to simply send a distinct packet to each destination wasteful of bandwidth and slow, should know complete list of all
destinations
multidestination routing:
each packet contains either a list of destinations or a bit map
indicating the desired destinations
Broadcast Routing
Reverse path forwarding: (a) A network. (b) A sink tree. (c) The tree
built by reverse path forwarding
Adv.: sends the broadcast packet over each link only once in
each direction, just as in flooding, yet it requires only that
routers know how to reach all destinations, without needing to
remember sequence numbers
Broadcast Routing
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
Adv.: excellent use of bandwidth, generating the
absolute minimum number of packets necessary to
do the job
Issue: each router must have knowledge of some
spanning tree for the method to be applicable
Multicast Routing
Sending a message to a group is called multicasting,
and the routing algorithm used is called multicast
routing
create and destroy groups and to identify which routers
are members of a group
build on the broadcast routing schemes - sending
packets along spanning trees to deliver the packets
Each router can then construct its own pruned spanning
tree for each sender
Ex. DVMRP (Distance Vector Multicast Routing Protocol)
Pruning results in efficient spanning trees that use only
the links that are actually needed to reach members of
the group
Issues: lots of work for routers, especially for large
networks
Multicast Routing
(a) A network. (b) A spanning tree for the leftmost router.
(c) A multicast tree for group 1. (d) A multicast tree for group 2.
Multicast Routing
alternative design: core-based trees to compute a single spanning
tree for the group
All of the routers agree on a root (core) and build the tree by
sending a packet from each member to the root
The tree is the union of the paths traced by these packets
When the packet reaches the core, it is forwarded down the tree.
The inefficiency depends on where the core and senders are located,
but often it is reasonable when the core is in the middle of the
senders
Ex. PIM (Protocol Independent Multicast)
Anycast Routing
Anycast: A packet is delivered to the nearest member of
a group
to anycast to the members of group 1 - all be given the
address 1, instead of different addresses
DVR distribute vectors as usual, and nodes will choose
the shortest path to destination 1
(a) Anycast routes to
group 1.
(b) Topology seen by
the routing
protocol