0% found this document useful (0 votes)
40 views59 pages

Cn-Unit 3

Uploaded by

pn217551
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)
40 views59 pages

Cn-Unit 3

Uploaded by

pn217551
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/ 59

UNIT 3 - NETWORK LAYER

Switching : Packet Switching -


Internet protocol - IPV4 – IP
Addressing – Subnetting - IPV6,
ARP, RARP, ICMP, DHCP
Switching
Switching is the process of transferring data
packets from one device to another in a network, or
from one network to another, using specific devices
called switches.
Switching takes place at the Data Link layer of the
OSI Model. This means that after the generation of
data packets in the Physical Layer, switching is the
immediate next process in data communication.
A switch is a hardware device in a network that
connects other devices, like computers and servers.
It helps multiple devices share a network without
their data interfering with each other.
Types of Switching
Circuit Switching
In circuit switching network resources bandwidth
are divided into pieces and the bit delay is constant
during a connection.
The dedicated path/circuit established between the
sender and receiver provides a guaranteed data rate.
Data can be transmitted without any delays once the
circuit is established.
The telephone system network is one of the
examples of Circuit switching. TDM (Time Division
Multiplexing) and FDM (Frequency Division
Multiplexing) are two methods of multiplexing
multiple signals into a single carrier.
Circuit Switching are classified into two:
 Space-Division Switching: Space-Division switching
is a technique of Circuit Switching where the paths in
the circuits are separated from each other spatially.
 Time-Division Switching: It is a digital switching
technique. There is no need for crosspoints in this
switching. In Time-Division Switching, the incoming
signals, as well as outgoing signals, are received and
re-transmitted in a different time slot.
Phases in Circuit Switching
 Setup Phase
 Data Transfer Phase
 Teardown Phase
Efficiency: Inefficient
Application: Switching in Telephone network(voice
traffic)
Circuit Switching
Packet Switching
In order to transfer the file fast and efficiently over
the network and minimize the transmission latency,
the data is broken into small pieces of variable length,
called Packet.
At the destination, all these small parts (packets) have
to be reassembled, belonging to the same file.
A packet is composed of a payload and various control
information. No pre-setup or reservation of resources
is needed.
Packet Switching uses the Store and
Forward technique while switching the packets; while
forwarding the packet each hop first stores that
packet then forwards.
Advantages:
 More efficient in terms of bandwidth, since the
concept of reserving a circuit is not there.
 Minimal transmission latency.
 More reliable as a destination can detect the missing
packet.
 More fault tolerant because packets may follow a
different path in case any link is down, Unlike Circuit
Switching.
 Cost-effective and comparatively cheaper to
implement.
Approaches to Packet Switching:
 Connection-oriented Packet Switching (Virtual Circuit)
 Switched Virtual Circuit(SVC)
 Permanent Virtual Circuit(PVC)
 Connectionless Packet Switching (Datagram)
Datagram Approach:
Connectionless Service
In Datagram packet switching each packet has all
the necessary information like Source address,
destination address etc.
So each packet is treated independently.
They can choose different routes for transmitting
data inside the network.
There is no predefined route. So, the packets can be
received in any sequence at the destination.
Packets in this approach are called datagrams.
Datagram approach can cause the datagrams to
reach the destination out of order.
This mode of packet switching, doesn’t involve
setup, transfer and teardown phase.
Routing Table
In Packet Switching network, each switch (or packet
switch) has a routing table which is based on the
destination address.
The routing tables are dynamic and are updated
periodically.
The destination addresses and the corresponding
forwarding output ports are recorded in the tables.
This is different from the table of a circuit-switched
network in which each entry is created when the setup
phase is completed and deleted when the teardown
phase is over.
Routing table in a datagram network
 Efficient: It is better than circuit-switching network

 Application: Switching in Internet

 Advantages:
 No setup time: Datagram networks are connectionless and don't
require setup time.
 No fixed route: If a link or node fails, there's no need to
reestablish a path.
 Fault tolerance: Packets can be routed around busy parts of the
network or when an intermediate system fails.
 Flexibility: Datagrams are the most flexible form of
communication, allowing senders and receivers to change along
with priorities.
 Efficiency: Datagrams are more efficient than other packet types.
Virtual Circuit(VC) Approach: Connection-Oriented Service
It is a connection-oriented network.
In these networks, the path between the source
and the destination nodes that is followed by first
data packet gets allocated. All other data packets
transmitted between them will use the same path.
All the resources like buffers and bandwidth get
reserved before the transmission, and all data
packets consume same resources.
Since all packets follow the same path, a common
header and routing information is used by them.
They provide greater reliability and less complexity
owing to fixed paths and fixed resources.
3 Phases of Virtual - Circuit Transmission
Set up Phase − In this phase, a virtual circuit or a
route is established from the source to the destination
through number of switches. The source and destination
use global addresses using which the switches make
routing table entries.
Data Transfer − Once the virtual circuit is set up, all
packets follow the route established during the set up
phase adhering to the routing tables.
Teardown Phase − When data transfer is complete, the
source sends a teardown request. The destination
responds using a teardown confirmation. The switches
flush their routing table entries, thus relinquishing the
circuit.
ADDRESSING
 Global Addressing:
 It is used to create a Virtual-Circuit Identifier(VCI)
 Local Addressing (Virtual-circuit identifier) :
 It uniquely identifies the connection link at the switch and
carried in the header of the packet.
 Advantages of Virtual Circuit:
 Packets are delivered to the receiver in the same order sent
by the sender.
 Virtual circuit is a reliable network circuit.
 There is no need for overhead in each packet.
 Single global packet overhead is used in virtual circuit.
 Disadvantages of Virtual Circuit:
 Virtual circuit is costly to implement.
 It provides only connection-oriented service.
 Always a new connection set up is required for transmission.
INTERNET PROTOCOL
The Internet Protocol (IP) is a protocol, or set of
rules, for routing and addressing packets of data so
that they can travel across networks and arrive at
the correct destination.
Data traversing the Internet is divided into smaller
pieces, called packets.
IP information is attached to each packet, and this
information helps routers to send packets to the
right place.
Every device or domain that connects to the
Internet is assigned an IP address, and as packets
are directed to the IP address attached to them,
data arrives where it is needed.
Internet Protocol Version 4 (IPv4)
It is connectionless services: Datagram approach
IPv4 could be a 32-bit IP Address.
IPv4 could be a numeric address, and its bits are
separated by a dot.
The number of header fields is twelve and the
length of the header field is twenty.
It has Unicast, broadcast, and multicast-style
addresses.
IPv4 supports VLSM (Virtual Length Subnet
Mask).
IPv4 uses the Post Address Resolution Protocol to
map to the MAC address.
IPv4 Datagram Format
VER - Version (4 bits): Indicates the version
of the IPv4 protocol being used.
HLEN - Header Length (4 bits): Indicates the
length of the header in 32-bit words.
Service - Type of Service (8 bits):
Indicates the priority of the packet and any
special handling that should be applied to it.
It is also called as differentiated services,
which has 3 fields.
Precedence(3 bits): Defines Priority, Ranging
from 0(000 in binary) to 7(111 in binary)
Type of Services (TOS): specify Type of
Services value.
Reserved (R) – 1 bit , reserved for future use.
Service - Type of Service (8 bits)
Type of Service (TOS)
Total Length (16 bits): Indicates the total length
of the packet in bytes, including the header and
data.
Identification (16 bits): A unique number that is
used to identify the packet.
Flags (3 bits): Used to control fragmentation and
reassembly of the packet.
bit 0: Reserved; must be Zero
bit 1: Don’t Fragment (DF)
bit 2: More Fragment (MF)
Fragment Offset (13 bits): Indicates the position
of this fragment in the original packet.
TTL - Time to Live (8 bits): Indicates the
maximum number of hops that the packet can
make before it is discarded.
Protocol (8 bits): Indicates the type of
transport layer protocol being used (e.g. TCP,
UDP).
Header Checksum (16 bits): A checksum that
is used to verify the integrity of the header.
Source IP Address (32 bits): The IP address of
the sender of the packet.
Destination IP Address (32 bits): The IP
address of the intended recipient of the packet.
Options (variable length): Optional fields that
can be used to specify additional information
about the packet.
Fragmentation and Reassembly
It is a method for transmission of messages larger
than the network’s Maximum Transmission
Unit(MTU), Messages are fragmented into smaller
pieces by the sender and reassembled by the
receiver.
Fragmentation is the breaking of an IPV4 packet
that exceeds the MTU of the data link layer into
smaller IPV4 packets. Fragmentation is a process
performed by the sender or the forwarding routers.
Fragmentation relies on some of the fields in the
IPV4 header, which are as follows:
Identification: To identify fragments, we use a 16-bit
field.
When the packet is fragmented, the identification field
is copied into the fragmented packet headers to help
determine that the packet belongs to a specific frame.
Fragment offset: This is a 13-bit field that is used
to order the data into fragments; it helps in the
rearranging part.
MF (More fragments): It is a one-bit flag that
specifies if there are more fragments of the frame.
DF (Don't fragment): It is a one-bit flag that tells
the routers whether to fragment the packet or not.
If it is set to 00 then the packet can be
fragmented.
Reassembly
The reassembly process is carried out at the destination.
This is because packets take different routes through the
network and arrive at different times.
The steps of the process of reassembly are as follows:
 The destination identifies that the packet has been
fragmented using the MF and fragment offset fields.
 The destination categorizes the incoming packets
according to their identification fields. Two packets with
the same identification field are put in the same category.
 The packets within a category are sequenced using the MF
and fragment offset. First, the packets with MF equal
to 11 are sorted in ascending order based on their
fragment offset values. Then the packet having an MF
equal to 00 and a fragment offset not equal to 0 is placed at
the end, since it's the last packet.
IPv4 ADDRESSING
Logical (Universal) Address: 32 bit long(4
bytes), it encodes its network number and
host number. It remains the same.
Physical (Network) Address: It will change
from hop to hop.
ADDRESS SPACE:
It is defined as “The total number of addresses
used by the protocol”.
Eg: For N bits address, 2^N bits address space
can be used.
Notations: 3 types
Binary Notation: 32 bit address(4 byte address)
Dotted-Decimal Notation: 32 bit address
Hexadecimal Notation: 32 bit address

Eg: binary: 01000000 00100000 00010000


00000011
decimal: 64.32.16.17
HIERARCHY IN ADDRESSING: 2 parts
Prefix – Defines the network – n bits
Suffix - Defines the node – (32 – n) bits
Two address distribution mechanism in
IPv4
Classful addrssing
Classless addrssing
Classful Addressing
It divides the address space into fixed-size
classes, with a predefined number of bits
allocated to the network and host portions of
the address.
This system makes it easy to identify the network
and host parts of an IP address based on its class.
Key Characteristics:
Fixed classes of IP addresses (A, B, C, D, and E).
The network prefix and host identifier are
determined by the class.
Each class has a fixed number of bits assigned to
the network and host portions.
Class A
 IP addresses belonging to class A are assigned to the
networks that contain a large number of hosts.
 The network ID is 8 bits long.
 The host ID is 24 bits long.
 class A has a total of: 2^24 – 2 = 16,777,214 host ID
 IP addresses belonging to class A ranges from 0.0.0.0 –
127.255.255.255.
Class B
 IP address belonging to class B is assigned to networks
that range from medium-sized to large-sized networks.
 The network ID is 16 bits long.
 The host ID is 16 bits long.
 Class B has a total of:
 2^14 = 16384 network address
 2^16 – 2 = 65534 host address
 IP addresses belonging to class B ranges from 128.0.0.0
– 191.255.255.255.
Class C
 IP addresses belonging to class C are assigned to
small-sized networks.
 The network ID is 24 bits long.
 The host ID is 8 bits long.
 Class C has a total of:
 2^21 = 2097152 network address
 2^8 – 2 = 254 host address
 IP addresses belonging to class C range from
192.0.0.0 – 223.255.255.255.
Class D
 IP address belonging to class D is reserved
for multi-casting.
 Class D does not possess any subnet mask.
 IP addresses belonging to class D range from
224.0.0.0 – 239.255.255.255.
Class E
IP addresses belonging to class E are reserved
for experimental and research purposes.
IP addresses of class E range from 240.0.0.0 –
255.255.255.255.
This class doesn’t have any subnet mask.
The higher-order bits of the first octet of class
E are always set to 1111.
Problems with Classful Addressing
The problem with this classful addressing method is
that millions of class A addresses are wasted, many
of the class B addresses are wasted, whereas, the
number of addresses available in class C is so small
that it cannot cater to the needs of organizations.
Class D addresses are used for multicast routing and
are therefore available as a single block only.
Class E addresses are reserved.
It is called as Address Depletion Problem.
Depletion of address: The classful system
contributed to the rapid exhaustion of IPv4
addresses due to large, inflexible allocations.
Classless Addressing
This system uses variable-length subnet masking
(VLSM), where the division between the network and
host parts of the address is determined by a
customizable prefix length.
Key Characteristics:
 No fixed address classes (A, B, C); addresses are
assigned based on the size of the network, regardless of
traditional class boundaries.
 The prefix length specifies how many bits represent the
network portion.
 IP addresses are represented in CIDR notation, e.g.,
192.168.1.0/24, where /24 means the first 24 bits are used
for the network portion, leaving 8 bits for hosts.
 Allows subnetting and supernetting, providing better
control over address allocation.
Address Blocks
Divide address space into variable-length
blocks but no classes.
A block (range) of address granted to an
entity varies based on the nature and size of
entity needtobe connected.
Prefix Length - Slash Notation
CIDR allows for more flexible and efficient
use of the IPv4 address space by removing
the rigid boundaries imposed by classful
addressing.
CIDR addresses are represented using a
slash notation, which specifies the number of
bits in the network prefix.
For example, an IP address of 192.168.1.0
with a prefix length of 24 would be
represented as 192.168.1.0/24. This notation
indicates that the first 24 bits of the IP
address are the network prefix and the
remaining 8 bits are the host identifier.
In this example the host bits are separated by
a red line. In our first example we know there
are 8 host bits remaining (because 32 bits in
total minus 24 network bits = 8 host bits). This
means that the total possible IP addresses in
this range are 2⁸ (256 total IP addresses minus
2 addresses reserved for network and
broadcasting).
In the next example we’ve moved the red line
to illustrate only having 6 host bits left
(because 32 bits minus 26 network bits = 6
host bits). That means the total possible IP
addresses in this range are 2⁶ (64 total IP
addresses minus 2 addresses reserved for
network and broadcasting).
Extracting Information from an Address
Number of Address: 2^(32-N)
The n leftmost bits are kept, and the (32 - n)
rightmost bits are all set to zeroes to
determine the first address.
The n leftmost bits are kept, while the (32 - n)
rightmost bits are all set to 1s to determine
the last address.
Address Mask
Address mask is a way to find the first and
last addresses in the block.
It is a 32-bit number in which the n leftmost
bits are Is and the 32-n rightmost bits are 0s.
The number of addresses in the block N =
NOT (mask) +1.
The first address in the block = (Any address
in the block) AND (mask).
The last address in the block = (Any address
in the block) OR [NOT (mask)).
Network Address
Let us assume that an internet is made of 'm'
networks and a router with 'm' interfaces.
When a packet arrives at the router from any
source host, the router needs to know to which
network the packet should be sent and from which
interface the packet should be sent out
After the network address has been found, the
router consults its forwarding table to find the
corresponding interface from which the packet
should be sent out.
The network address is actually the identifier of
the network and each network is identified by its
network address.
Block Allocation
Another issue with Classless addressing is the
allocation of block.
The ultimate responsibility of block allocation is
given to a global authority named Internet
Corporation for Assigned Names and Numbers
(ICANN); it is not normally allocating the address to
the individual organizations.
Generally, it assigns a large block of addresses to an
ISP that is, large organization.
Each ISP, in turn, divides its assigned block into
smaller sub blocks and then issue those sub blocks to
its customers.
This process is called address aggregation.
Special Addresses
IPv4 use five special addresses that are used
for special purposes:
1. This-host address: The only address in the
block 0.0.0.0/32 is called the this-host
address which is used by a host needs to send
an IP datagram but it does not know its own
address to use as the source address.
2. Limited-broadcast address: The only
address in the block 255.255.255.255/32 is
called the limited. broadcast address which is
used whenever a router or a host needs to
send a datagram to all devices in a network.
3. Loopback address: The block
127.0.0.0/8 is called the loopback address. A
packet with one of the addresses in this block
as the destination address never leaves the
host and it will remain in the host.
4. Private address: Four blocks are assigned
as private addresses: 10.0.0.0/8,
172.16.0.0/12, 192.168.0.0/16 and
169.254.0.0/16 which are used any
applications purpose.
5. Multicast address: The block 224.0.0.0/4
is reserved for multicast addresses.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy