CN Module 3
CN Module 3
Unit - 3
Network Layer
CO1: Identify the concepts of OSI and TCP/IP reference models and their
applications.
3
Data Link Layer
• The data link layer is responsible for moving frames from
one hop (node) to the next
• Transform the physical layer to a reliable (error-free) link
2-4
Hop-to-Hop Delivery
2-5
Network Layer
• The network layer is responsible for the delivery of
packets from the source host to the destination host
2-6
Network Layer: Duties
• Logical addressing and routing
2-7
• The primary function of the network layer is to enable
different networks to be interconnected.
• For example, PPP. At this point the carrier takes over. Every router
has an internal table telling it where to send packets for each
possible destination. Each table entry is a pair consisting of a
destination and the outgoing line to use for that destination. Only
directly connected lines can be used.
• The idea behind virtual circuits is to avoid choosing a new route for
every packet sent.
• When a connection is established, a route from the source machine
to the destination machine is chosen as a 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 belongs to.
Routing Algorithms
➢ Decentralized:
Router knows physically – connected neighbors, link costs to
neighbors, Iterative process of computation, exchange of info with
neighbors.
Eg: Distance vector algorithms
➢ Static: Routes are fixed and can change slowly over time.
➢ Dynamic: Routes change more quickly/automatically
• Periodic updates
Routing Algorithms
Network layer functions
• Correctness
• Simplicity
• Robustness
• Stability
• Fairness
• Optimality
Routing Algorithms
4.It can also occur when two routers send updates to each other
at the same time
Count to infinity problem
Link state routing algorithm
The idea behind linked state routing is simple and can be
stated as five parts. Each router must do the following:
• So, routers save one record in their table for every other
region.
Warning bit:
• Special bit in packets header.
• As long as warning bits continues to flow in, the source
continued to decrease its transmission rate.
Choke packet:
• When the source host receive choke, it should reduce the
traffic sharply.
• If no choke packet arrives for a period, the host may increase
the flow slowly.
Load shedding
Jitter control
Average arrival rate of packets (or variation in the packet
arrival times) is called jitter.
Traffic Shaping is a mechanism to control the amount and the rate of traffic sent to
the network. Approach of congestion management is called Traffic shaping. Traffic
shaping helps to regulate the rate of data transmission and reduces congestion.
When too many packets are present in the network it causes packet delay and
loss of packet which degrades the performance of the system. This situation is
called congestion.
The network layer and transport layer share the responsibility for handling
congestions.
One of the most effective ways to control congestion is trying to reduce the
load that transport layer is placing on the network.
To maintain this, the network and transport layers have to work together.
There are two types of Congestion control algorithms, which are as follows −
•Leaky Bucket Algorithm
•Token Bucket Algorithm
Leaky Bucket Algorithm
Step 1 − Let us imagine a bucket with a small hole at the
bottom where the rate at which water is poured into the
bucket is not constant and can vary but it leaks from the
bucket at a constant rate.
Step 2 − So (up to water is present in the bucket), the
rate at which the water leaks does not depend on the
rate at which the water is input to the bucket.
Step 3 − If the bucket is full, additional water that enters
into the bucket that spills over the sides and is lost.
Step 4 − Similarly, in networking, a technique called leaky
bucket can smooth out bursty traffic. Bursty chunks are stored
in the bucket and sent out at an average rate.
The network layer in the internet
• IPv4
• Sub-netting
• Super-netting
• CIDR
• NAT
• IPv6
The network layer in the Internet
Total Length
This 16-bit field defines the entire packet size in bytes, including header and data. The
minimum size is 20 bytes (header without data) and the maximum is 65,535 bytes.
All hosts are required to be able to reassemble datagrams of size up to 576 bytes,
but most modern hosts handle much larger packets. Links may impose further
restrictions on the packet size, in which case datagrams must be fragmented.
Fragmentation in IPv4 is performed in either the sending host or in routers.
Reassembly is performed at the receiving host.
Identification
This field is an identification field and is primarily used for
uniquely identifying the group of fragments of a single IP
datagram. Some experimental work has suggested using
the ID field for other purposes, such as for adding packet-
tracing information to help trace datagrams with spoofed
source addresses,[38] but RFC 6864 now prohibits any
such use.
Flags
A three-bit field follows and is used to control or identify
fragments. They are (in order, from most significant to
least significant):
• bit 0: Reserved; must be zero.[b]
• bit 1: Don't Fragment (DF)
• bit 2: More Fragments (MF)
Fragment offset
This field specifies the offset of a particular fragment relative to the
beginning of the original unfragmented IP datagram in units of
eight-byte blocks. The first fragment has an offset of zero. The 13
bit field allows a maximum offset of (213 – 1) × 8 = 65,528 bytes,
which, with the header length included (65,528 + 20 = 65,548
bytes), supports fragmentation of packets exceeding the maximum
IP length of 65,535 bytes.
Protocol
This field defines the protocol used in the data portion of the IP
datagram. IANA maintains a list of IP protocol numbers as directed
by RFC 790.
Header checksum
The 16-bit IPv4 header checksum field is used for error-checking of the header. When a packet
arrives at a router, the router calculates the checksum of the header and compares it to the
checksum field. If the values do not match, the router discards the packet. Errors in the data
field must be handled by the encapsulated protocol. Both UDP and TCP have separate
checksums that apply to their data.
Source address
This field is the IPv4 address of the sender of the packet. Note that this address may be changed in
transit by a network address translation device.
Destination address
This field is the IPv4 address of the receiver of the packet. As with the source address, this may be
changed in transit by a network address translation device.
Options
The options field is not often used. Packets containing some options may be considered as
dangerous by some routers and be blocked. Note that the value in the IHL field must include
enough extra 32-bit words to hold all the options plus any padding needed to ensure that the
header contains an integer number of 32-bit words.
IPv6 (128 bit)
Version (4-bits): Indicates version of Internet Protocol which
contains bit sequence 0110.
Traffic Class (8-bits): The Traffic Class field indicates class or priority
of IPv6 packet which is like Service Field in IPv4 packet. It helps
routers to handle the traffic based on the priority of the packet. If
congestion occurs on the router then packets with the least priority
will be discarded.
As of now, only 4-bits are being used (and the remaining bits are
under research), in which 0 to 7 are assigned to Congestion
controlled traffic and 8 to 15 are assigned to Uncontrolled traffic.
Flow Label (20-bits): Flow Label field is used by a source to label the packets
belonging to the same flow in order to request special handling by
intermediate IPv6 routers, such as non-default quality of service or real-time
service. In order to distinguish the flow, an intermediate router can use the
source address, a destination address, and flow label of the packets
Next Header (8-bits): Next Header indicates the type of extension header(if
present) immediately following the IPv6 header. Whereas In some cases it
indicates the protocols contained within upper-layer packets, such as TCP,
UDP.
Hop Limit (8-bits): Hop Limit field is the same as TTL in IPv4 packets. It indicates the
maximum number of intermediate nodes IPv6 packet is allowed to travel. Its value gets
decremented by one, by each node that forwards the packet and the packet is discarded if
the value decrements to 0. This is used to discard the packets that are stuck in an infinite
loop because of some routing error.
Source Address (128-bits): Source Address is the 128-bit IPv6 address of the original
source of the packet.
Destination Address (128-bits): The destination Address field indicates the IPv6 address of
the final destination(in most cases). All the intermediate nodes can use this information in
order to correctly route the packet.
Extension Headers: In order to rectify the limitations of the IPv4 Option Field, Extension
Headers are introduced in IP version 6. The extension header mechanism is a very
important part of the IPv6 architecture. The next Header field of IPv6 fixed header points
to the first Extension Header and this first extension header points to the second
extension header and so on.
IPv4 Vs. IPv6
Subnetting
A subnetting or subnetwork
is a segmented piece of large
network.
Class B
Class C
One node to be
communicated
with another
node. It sends a
broadcast
message.
Broadcasting in a single network which are connected with too many devices
All devices
broad casting
in the network
leads to loss of
that system.
To prevent this
networks, need
to be broken
into smaller
networks
Therefore, IP address
have network portion
and the host portion.