0% found this document useful (0 votes)
38 views78 pages

Network Layer

The document discusses key concepts in network layer design including store-and-forward packet switching, connectionless and connection-oriented services, and routing algorithms. It describes how packets are routed hop-by-hop through networks using store-and-forward switching. It also compares datagram and virtual circuit implementations and discusses routing approaches like flooding, distance vector, and link state routing.

Uploaded by

farhana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views78 pages

Network Layer

The document discusses key concepts in network layer design including store-and-forward packet switching, connectionless and connection-oriented services, and routing algorithms. It describes how packets are routed hop-by-hop through networks using store-and-forward switching. It also compares datagram and virtual circuit implementations and discusses routing approaches like flooding, distance vector, and link state routing.

Uploaded by

farhana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 78

The Network Layer

Network Layer Design Issues


• Store-and-Forward Packet Switching
• Services Provided to the Transport Layer
• Implementation of Connectionless Service
• Implementation of Connection-Oriented Service
• Comparison of Virtual-Circuit and Datagram Subnets
Store-and-Forward Packet Switching
• The environment of the network layer protocols
Store-and-Forward Packet Switching
• 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 carrier.
• The packet is stored there until it has fully arrived so the checksum can be
verified. Then it is forwarded to the next router along the path until it reaches the
destination host, where it is delivered.
Services Provided to the Transport Layer
• The service 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.
Implementation of Connectionless Service
• Packets are frequently called Datagrams
• Subnet is called a Datagram Subnet.
• Routing within a datagram subnet
Implementation of Connection-Oriented Service

• Routing within a virtual-circuit subnet


Implementation of Connection-Oriented Service

• In connection-oriented service a path from the source router to the destination


router must be established before any data packets can be sent.
• This connection is called a VC (virtual circuit), in analogy with the physical circuits
set up by the telephone system, and
• The subnet is called a virtual-circuit subnet.
Comparison of Virtual-Circuit and Datagram Subnets
Routing Algorithms
• The main function of the network layer is routing packets from the source
machine to the destination machine.
• The routing algorithm is that part of the network layer software responsible for
deciding which output line an incoming packet should be transmitted on.
• If the subnet uses datagrams internally, this decision must be made anew for
every arriving data packet since the best route may have changed since last time.
• If the subnet uses virtual circuits internally, routing decisions are made only when
a new virtual circuit is being set up. Thereafter, data packets just follow the
previously-established route. The latter case is sometimes called session routing
because a route remains in force for an entire user session.
Routing Algorithms

Routing Algorithms

Non Adaptive Adaptive

Shortest Distance
Flooding
Path Vector Link State
Routing Algorithms
• Nonadaptive algorithms do not base their routing decisions on measurements or
estimate of the current traffic and topology.
• This is also know as Static Routing.
• Routing process will be designed in advance.
• Adaptive algorithms change their routing decisions to reflect changes in the
topology, and usually the traffic as well.
• Adaptive algorithms differ in where they get their information when they
change the routes and what metric is used for optimization (e.g., distance,
number of hops, or estimated transit time).
• This is also know as Dynamic Routing.
Routing Algorithms
• Hierarchical Routing
• Broadcast Routing
• Multicast Routing
The Optimality Principle
• One can make a general statement about optimal routes without regard
to network topology or traffic. This statement is known as the Optimality
Principle.
• 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
The Optimality Principle
Shortest Path Routing
Shortest Path Routing
• Dijkstra
• To choose a route between a given pair of routers, the algorithm just finds the shortest
path between them on the graph.
• In the general case, the labels on the arcs could be computed as a function of the
distance, bandwidth, average traffic, communication cost, mean queue length, measured
delay, and other factors.
• We examine, in turn, each of the nodes adjacent to(the working node), relabeling each
one with the distance . Whenever a node is relabeled, we also label it with the node from
which the probe was made so that we can reconstruct the final path later.
• Having examined each of the nodes adjacent, we examine all the tentatively labeled
nodes in the whole graph and make the one with the smallest label permanent, This one
becomes he new working node.
Shortest Path Routing
• After all the nodes adjacent to the working node have been inspected and the
tentative labels changed if possible, the entire graph is searched for the
tentatively-labeled node with the smallest value.
• This node is made permanent and becomes the working node for the next round.
Flooding
• Static routing
• Every incoming packet is sent out on every outgoing line except the one arrived
• Generates large no’of duplicate packets.
• To damp the process, hop counter is used, which is decremented at each
hop.when it reaches 0 , the packet is discarded.
• Another technique is to keep track which packets have been flooded, to avoid
sending them second time.
Flooding
• Selective Flooding
• Routers do not flood them on to every outer line, instead flood only on those
lines that are going approximately in the right direction
• Applications
• Distributed database applications
• Wireless networks
Distance Vector Routing
• Two dynamic algorithms in particular, distance vector routing and link state
routing,are the most popular.
• Distance vector routing algorithms operate by having each router maintain a
table (i.e, a vector) giving the best known distance to each destination and which
line to use to get there.
• These tables are updated by exchanging information with the neighbors.
• The distance vector routing algorithm is sometimes called by other names, most
commonly the distributed Bellman-Ford routing algorithm and
the Ford-Fulkerson algorithm.
Distance Vector Routing
• In distance vector routing, each router maintains a routing table indexed by, and
containing one entry for, each router in the subnet.
• This entry contains two parts: the preferred outgoing line to use for
that destination and an estimate of the time or distance to that destination.
• The metric used might be number of hops, time delay in milliseconds, total
number of packets queued along the path, or something similar.
• As an example, assume that delay is used as a metric and that the router knows
the delay to each of its neighbors.
• Once every T msec each router sends to each neighbor a list of its estimated
delays to each destination.
• It also receives a similar list from each neighbor.
Distance Vector Routing
• Each router calculates the estimated delay to reach to some router
using the received list.
J wants to calculate delay to G
J Calculated delays to its
neighbors :A,I,H and K as below
J to A 🡪8
J to I 🡪10
J to
H🡪12 J
to K🡪6
Distance Vector Routing
• New routing
C;
J to G Via A=26 (8+18)

J to G via I

=41(31+10) J to G via

H =18(6+12) J to G

via K=37(31+6)

Among these the best is 18 i.e


Via H
Count to Infinity Problem
• Initially B will know that it can get to C at a cost of 1 and
• A will know that it can get to C via B at a cost of 2.
Count to Infinity Problem
• If the link between B and C is disconnected, then B will know that it can no longer
get to C via that link and will remove it from it’s table.
• Before it can send any updates it’s possible that it will receive an update from A
which will be advertising that it can get to C at a cost of 2.
• B can get to A at a cost of 1, so it will update a route to C via A at a cost of 3.
• A will then receive updates from B later and update its cost to 4.
• They will then go on feeding each other bad information toward infinity which is
called as Count to Infinity problem.
Link State Routing
• The idea behind link state routing is simple and can be stated as five parts. Each
router must do the following:
1. Discover its neighbors and learn their network addresses.
2. Measure the delay or cost to each of its neighbors.
3. Construct a packet telling all it has just learned.
4. Send this packet to all other routers.
5. Compute the shortest path to every other router.
Learning about the Neighbors
• It accomplishes this goal by sending a special HELLO packet on each point-to-
point line. The router on the other end is expected to send back a reply telling
who it is.
• Fig (a) Nine routers and a LAN. (b) A graph model of (a)
Measuring Line Cost
• The most direct way to determine this delay is to send over the line a special
ECHO packet that the other side is required to send back immediately.
• By measuring the round-trip time and dividing it by two, the sending router can
get a reasonable estimate of the delay.
• Including traffic-induced delays in the measurements means that when a router
has a choice between two lines with the same bandwidth, one of which is heavily
loaded all the time and one of which is not, the router will regard the route over
the unloaded line as a shorter path. This choice will result in better performance
Building Link State Packets
• Next step is for each router to build a packet containing all the data.
• Building the link state packets is easy. The hard part is determining when to build
them.
• One possibility is to build them periodically, that is, at regular intervals.
• Another possibility is to build them when some significant event occurs, such as a
line or neighbor going down or coming back up again or changing its properties
appreciably.
Building Link State Packets
• The packet starts with the identity of the sender, followed by a sequence number
and age and a list of neighbors. For each neighbor, the delay to that neighbor is
given.
• Fig (a) A subnet. (b) The link state packets for this subnet
Distribute the Link State Packets
• First,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.
• If a packet with a sequence number lower than the highest one seen so far ever
arrives, it is rejected as being obsolete since the router has more recent data.
Distribute the Link State Packets
• Second, if a router ever crashes, it will lose track of its sequence number. If it
starts again at 0.
• Third, sequence number is ever corrupted.
• 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.
• The Age field is also decremented by each router during the initial flooding
process, to make sure no packet can get lost and live for an indefinite period of
time.
Distribute the Link State Packets
• Fig :The packet buffer for router B.
• At E,It arrived twice, once via EAB and once via EFB.
• At D, It arrived twice, once via DCB and once via DFB.
Computing the New Routes
• Dijkstra’s algorithm can be used.
• For a subnet with n routers, k neighbours, the memory required to store data is
proportional to kn.
• The OSPF(Open Shortest Path First) protocol, which is widely used in the Internet,
uses a link state algorithm.
• Basically IS-IS(Intermediate System-Intermediate System) distributes a picture of
the router topology, from which the shortest paths are computed. Each router
announces, in its link state information, which network layer addresses it can
reach directly
Congestion Control Algorithms
• General Principles of Congestion Control
• Congestion Prevention Policies
• Congestion Control in Virtual-Circuit Subnets
• Congestion Control in Datagram Subnets
• Load Shedding
• Jitter Control
Congestion Control Algorithms
• When too many packets are present in (a part of) the subnet,
performance degrades. This situation is called congestion.
• Figure: When too much traffic is offered, congestion sets in and performance
degrades sharply.
Causes of Congestion
• Congestion occurs when a router receives data faster than it can send it
• Insufficient bandwidth
• Slow hosts
• Data simultaneously arriving from multiple lines destined for the
same outgoing line
• The system is not balanced
• Correcting the problem at one router will probably just move the bottleneck
to another router.
Congestion Control versus Flow Control
• Flow control
• controls point-to-point traffic between sender and receiver
• It is a local issue.
• e.g., a fast host sending to a slow host
• Congestion Control
• controls the traffic throughout the network
• It is a global issue. Involving the behavior of all the hosts all the routers.
General Principles of Congestion Control
• Open loop solutions
• Attempt to prevent problems rather than correct them, by good design.
• Does not utilize runtime feedback from the system
• Closed loop solutions
• Uses feedback (measurements of system performance) to make corrections at
runtime.
Open Loop Solutions
• Tools for doing open-loop control include
• Deciding when to accept new traffic,
• Deciding when to discard packets and which ones,
• Making scheduling decisions at various points in the network
Closed Loop solutions
1. Monitor the system
• .The Percentage Of All Packets Discarded For Lack Of Buffer Space,
• The Average Queue Lengths,
• The Number Of Packets That Time Out And Are Retransmitted,
• The Average Packet Delay, And The
• Standard Deviation Of Packet Delay.
2. Pass information to where action can be taken.
• Feedback loop is to transfer the information about the congestion from the
point where it is detected to the point where something can be done about it.
3. Adjust system operation to correct the problem
Closed Loop Solutions
• Bit or field can be reserved in every packet for routers to fill in whenever
congestion gets above some threshold level. When a router detects this
congested state, it fills in the field in all outgoing packets, to warn the neighbors.
• Still another approach is to have hosts or routers periodically send probe packets
out to explicitly ask about congestion. This information can then be used to route
traffic around problem areas.
• The presence of congestion means that the load is (temporarily) greater than the
resources can handle.
• Load > Resources congestion
• 6>8 increase the resources
• 4 > 6 decrease the load
Reducing Congestion
• Increase resources • Decrease Traffic
• Get additional bandwidth • Send messages to
• Use faster lines senders telling them to slow
• Obtain additional lines down
• Utilize alternate pathways • Deny service to some users
• Utilize “spare” routers • Degrade service to some or all
users
• Schedule usage to
achieve better load balance
Congestion Prevention Policies
• Policies that affect congestion.
• Methods to control congestion by looking at open loop
systems
Congestion Control in Virtual-Circuit Subnets
• Three Methods
• Admission Control: once congestion has been signaled no more virtual
circuits are set up until the problem has gone away. It is simple and easy to
carry out.
• Allow New Circuits but carefully route all new virtual circuits around
problem areas.
• Negotiate an agreement between the host & subnet when a virtual circuit is
set up.
• This agreement normally specifies the volume and shape of the traffic,
quality of service required, and other parameters. To keep its part of
agreement, the subnet will typically reserve resources along the path
when the circuit is setup. These resources can include table, buffer space
in the routers, and band width on the lines.
Congestion Control in Virtual-Circuit Subnets
• (a) A congested subnet. (b) A redrawn subnet, eliminates congestion and a virtual
circuit from A to B.
Congestion Control in Data gram Subnets
• Warning Bit
• Choke Packets
• Hop-by-Hop Choke Packets

Other Techniques
• Load Shedding
• Random Early detection (RED)
• Jitter Control
The Warning bit
• It is a method of setting a special bit in the packets header by router.
• As long as the router is in the warning state, it continues to set the warning
bit, which means that the source continued to get acknowledgement with
the warning bit being set.
• As long as the warning bit continued to flow in, the source continued to
decrease its transmission rate.
• Since every router along the path can set the warning bit, traffic increases
only when no router is in trouble.
Choke Packet
• A more direct way of telling the source to slow down.
• Achoke packet is a control packet generated at a congested node
transmitted
and to restrict traffic flow.
• The source, on receiving the choke packet must reduce its transmission rate by a
certain percentage. For a fixed time interval.
• After the period has expired, if the source receives choke packets from the same
destination, it reduces the traffic still more and begins ignoring choke packets
again.
• If no choke packets arrive during the listening period, the host may increase the
flow again.
Hop-by-Hop Choke Packets
• Over long distances or at high speeds choke packets are not very effective.
• A more efficient method is to send to choke packets hop-by-hop.
• This requires each hop to reduce its transmission even before the choke packet
arrive at the source.
• The net effect of this hop-by-hop scheme is to provide quick relief at
the congestion at the price of using up more buffers upstream.
Hop-by-Hop Choke Packets
(a)A choke packet that affects
only the source.
(b)A choke packet that affects
each hop it passes through.
Load Shedding
• It is a fancy way of saying that when routers are being inundated (over whelm as
if with a flood),(When buffers become full,) routers simply discard packets.
• Which packet is chosen to be the victim depends on the application and on the
error strategy used in the data link layer.
• For a file transfer, for, e.g. cannot discard older packets since this will cause a gap
in the received data. An old packet is worth more than a new one. This policy
is often called wine.
• For real-time voice or video it is probably better to throw away old data and keep
new packets. For multimedia, a new packet is more important than an old one,
this policy is often called milk.
Wine: drop new packets (keep old); good for file transfer
Milk: drop old packets (keep new); good for multimedia
Random Early Detection (RED)
• This is a proactive approach in which the router discards one or more packets
before the buffer becomes completely full(Floyd & Jacobson in 1993).
• Each time a packet arrives, the RED algorithm computes the average
queue length, avg.
• If avg is lower than some lower threshold, congestion is assumed to be minimal
or non-existent and the packet is queued.
• If avg is greater than some upper threshold, congestion is assumed to be serious
and the packet is discarded.
• If avg is between the two thresholds, this might indicate the onset of congestion.
The probability of congestion is then calculated.
Jitter Control
• For applications such as audio and video streaming, it does not matter much if
the packets take 20 msec or 30 msec to be delivered, as long as the transit time is
constant.
• The variation (i.e., standard deviation) in the packet arrival times is called jitter.
• High jitter, for ex: having some packets taking 20 msec and others taking 30 msec
to arrive give an uneven quality to the sound, movie.
• An agreement that 99 percent of the packets be delivered with a delay in the
range of 24.5 msec to 25.5 msec might be acceptable.
• The jitter can be bounded by computing the expected transit time for each hop
along the path.
• Packets that are ahead of schedule get slowed down and behind schedule get
speeded up, in both cases reducing the amount of jitter.
Jitter Control
• (a) High jitter. (b) Low jitter.
IPV4 Address
• ICANN(Internet Corporation for Assigned Names and Number)
• An IPv4 address is a 32-bit address that uniquely and universally defines the
connection of a device (for example, a computer or a router) to the Internet.
• An IPv4 address is 32 bits long.
• The address space of IPv4 is 232 or 4,294,967,296.
• Figure:Dotted-decimal notation and binary notation for an IPv4 address
IPV4 Address
• Change the following IPv4 addresses from binary notation to dotted-decimal
notation.

• We replace each group of 8 bits with its equivalent decimal number and add
dots for separation.
IPV4 Address
• Change the following IPv4 addresses from dotted-decimal notation to binary
notation

• We replace each decimal number with its binary equivalent


Class full Addressing
Class full Addressing
• Find the class of each address.

• a. 00000001 00001011 00001011 11101111


• b. 11000001 10000011 00011011 11111111
•c 10001001 00001011 10011011 11101111
• d. 14.23.120.8
•e 252.5.15.111
• f. 230.6.78.5
Class full Addressing
• Netid and Hostid :only class A,B,C is divided into netid and hostid.
• Mask help to find netid and hostid
IPV4 Address
ClasslessAddressing(CIDR)
• Classless Inter Domain Routing(CIDR)
• Restrictions
• The addresses are contiguous.
• The number of addresses is a power of 2 (16 = 24), (1,2,4,8,16,32…….)
• The first address is divisible by 16.
• In IPv4 addressing, a block of addresses can be defined as x.y.z.t /n in which x.y.z.t
defines one of the addresses and the /n defines the mask
• The first address in the block can be found by setting the rightmost 32 − n bits to
0s.
• The last address in the block can be found by setting the rightmost 32 − n bits to
1s.
• The number of addresses in the block can be found by using the formula
232−n.
Classless Addressing(CIDR)
IPV4 Header Format
• Unreliable and Connection Less
• Datagram = Header(20 -60) bytes +Payload(0-65515) bytes

216 =65,535 (if header is 20)


IPV4 Header Format
Supernetting v/s Subnetting
• Subnetting is the procedure to divide the network into sub-networks or small
networks.
Subne t id Host id

• Supernetting is the procedure to combine the small networks into larger


space.
• In subnetting, Network addresses’s bits are increased where as supernetting,
Network addresses’s bits are decreased.
• Subnetting is implemented via Variable-length subnet masking,While
supernetting is implemented via Classless interdomain routing.
• In Subnetting mask bits are moved towards right where as in supernetting left of
the default mask.
Supernetting v/s Subnetting
IPV6
• 128 Bits or 16 Bytes (16*8)
•2 128
• Dotted Decimal :
221.14.65.11.105.45.170.34.12.234.18.0.14.0.115.255
• Colon Hexa Decimal :
FDEC:BA98:7654:3210:ADBF:BBFF:2922:FFFF
• Abbreviation :Removing leading zero’s
•• Example:FDEC:0074:0000:0000:0000:B0FF:0000:FFF0
• FDEC:74:0:0:0:B0FF:0:FFF0 FDEC:74::B0FF:0:FFF0

IPV6 Header Format
IPV6
• Extension Header
Network Address Translation (NAT)
• The basic idea behind NAT is to assign each company a single IP address (or at
most, a small number of them) for Internet traffic. Within the company, every
computer gets a unique IP address, which is used for routing intramural traffic.
• Network Address Translation (NAT) is a process in which one or more local IP
address is translated into one or more Global IP address and vice versa in order to
provide Internet access to the local hosts
• Also, it does the translation of port numbers i.e. masks the port number of the
host with another port number, in the packet that will be routed to the
destination.
Network Address Translation (NAT)
• It then makes the corresponding entries of IP address and port number in the
NAT table.
• NAT generally operates on router or firewall.
• Generally, the border router is configured for NAT i.e the router which has one
interface in local (inside) network and one interface in the global (outside)
network.
• When a packet traverse outside the local (inside) network, then NAT converts that
local (private) IP address to a global (public) IP address.
• When a packet enters the local network, the global (public) IP address is
converted to a local (private) IP address.
NAT
Private IP Address
• The three reserved ranges are:
• 10.0.0.0 – 10.255.255.255(16,777,216 hosts)
• 172.16.0.0 – 172.31.255.255 (1,048,576 hosts)
• 192.168.0.0 – 192.168.255.255/16 (65,536 hosts)
Advantages
• It hide the real IP address of your internal network from the public
network.
• It allow unlimited no of private addresses to access to single internet
connection.

You might also like