Internet Protocol
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 1
Textbook Used
Data communication and Networking by Behrouz A.
Forouzan, 4th Edition
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 2
Outline
⚫ IPV4 Datagram structure
⚫ IPV6 Datagram Structure
⚫ ARP & RARP
⚫ ARP, RARP
⚫ IPV4 Addressing
⚫ Subnetting
⚫ IPV6 Addressing
⚫ ICMPV4 and V6
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 3
IPV4 Datagram structure
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 4
IPV4 Datagram Format
➢ Packets in IP layer are called Datagram
➢ Datagram is a variable length packet upto 65536 bytes
consisting of two parts: header and data
➢ Header length can be from 20 to 60 bytes and contains
information essential to routing and delivery
➢ Brief description of each field :
❖ Version (4 bits): First field identifies the version number
of IP. Current version is IPV4
❖ Header Length (4 bits): HLEN field defines the length of
the header in terms of number of 32 bit words. The
minimum length is 5 (20 Octets) and maximum length is
15 (60 Octets)
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 5
IPV4 Datagram Format
❖ Service Type (TOS): Type of service field defines how
the datagram should be handled. Specifies Priority,
Throughput and reliability parameters. Five subfields as
shown in fig
Field was later changed and first six bits were renamed as
DSCP and last two bits reserved for future use.
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 6
❖ Total Length(16 bits) : Total Length field defines the total
length of IP datagram including header and data.
Maximum size of packet is 65,535 octets.
❖ Identification(16 bits) : This field is used in
fragmentation. Datagram when passing through different
networks may be divided into fragments to match the
network frame size.
❖ Flags(3 bits): Bits in flag field deal with fragmentation.
❖ Fragment Offset(13 bits): Pointer that shows the offset of
the data in the original datagram
❖ Time to Live(8 bits): Defines the number of hops, a
datagram can travel before it is discarded.
❖ Protocol(8 bits): Protocol field defines which is upper
layer protocol data are encapsulated in datagram
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 7
❖ Header Checksum(16 bits): 16 bit field used to check the
integrity of the header
❖ Source Address(16 bits): Four byte address field of
Internet address. Identifies the original source of the
datagram
❖ Destination Address(16 bits): Four byte Internet
Address. Identifies the final destination of the datagram
❖ Options(Variable size): Gives more functionality to IP
datagram. Carry filed that control Routing, timing,
management and alignment.
❖ Padding(Variable size) : Ensures the header ends on 32-
bit boundary . It is filled with 0s
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 8
Address Resolution Protocol
➢ Protocol used for finding the physical address of the
network only when the network address is known.
➢ Basically ARP is for translating IP address to Ethernet
MAC address
➢ Used for IP over LAN technologies such as Ethernet,
Token ring, FDDI, IP over ATM
➢ In an Ethernet network, two addresses are used to
identify the source and the destination of the information
sent by a host.
➢ All information sent by a computer contains the
computer's hardware source address, source IP address,
destination hardware address and destination IP address.
➢ ARP is needed to link the two.
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 9
ARP Operation
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 10
ARP operation
• When a host wants to send an IP packet to another host, it first
determines whether the destination is on the same network or
different network.
• If the network prefixes of the source and destination IP addresses
are different, the destination station is on different network
• If the network prefixes are same, destination is on the same LAN
• ARP used within a LAN to determine the MAC address of station or
router to whom an IP packet is to be delivered.
• Basic operation of ARP involves following five steps
❖ System A that wants to locate the MAC address of system B having
IP address sends an ARP request packet with IP and MAC address of
source and target IP address. ARP request is encapsulated in a MAC
frame with broadcast address so that all devices on LAN receive it
❖ Frame is received by all stations/ routers on LAN. All stations take
a note of MAC and IP address of the source in their ARP cache for
future use.
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 11
ARP operation
❖ System B having IP address same as target IP address in the ARP
request packet responds with ARP response packet. ARP response
packet contains its MAC address as one of the fields. ARP response
packet is encapsulated in a MAC frame addressed to system A.
❖ On receipt of ARP response, System A take note of the MAC address
and IP address of B in its ARP Cache. Having obtained the MAC
address of B, A can now send the frames containing IP packets
directly to B.
❖ Entries in ARP Cache are deleted if they are not used for defined
period of time, which is usually 5 minutes
• If destination is on different network, the IP packet is to be sent to
router connected on the LAN.
• So ARP request packet is sent to router on router’s default gateway
• ARP request is broadcast and ARP reply is unicast
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 12
Format of ARP Packet
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 13
ARP Packet Format
• Hardware Type : Indicates type of Layer-2 network.
• Protocol Type: Indicates the protocol ARP is working
• Hardware Address Length: Indicates the length of
hardware address fields in Octets.
• Protocol Address Length: Indicates the length of
Protocol address in Octets
• Operation Code: Indicates type of ARP/RARP packets
➢ ARP Request : 1
➢ ARP Reply: 2
➢ RARP Request : 3
➢ RARP Reply: 4
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 14
ARP Packet Format
• Source Hardware Address: Contains Layer-2 address of
the source
• Source Protocol Address: Contains layer-3 address of
the source
• Target Hardware Address: Contains layer-2 address of
the target device
• Target protocol Address : contains Layer-3 address of
the target device.
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 15
Encapsulation of ARP Packet
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 16
Reverse Address Resolution Protocol
➢ Protocol used for finding the IP address of the network
only when the physical address is known.
➢ Basically RARP is for translating Ethernet MAC address
to IP Address
➢ RARP is reverse of ARP.
➢ Functioning of RARP is similar to ARP except that it
sends the request asking “does anyone know whose IP
address belongs to the physical address.
➢ when correct destination hears it, it will respond with the
IP address
➢ The RARP cache is then updated and the original
information can be routed to its designated target.
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 17
IP Next Generation
• The current version of the Internet Protocol, used to send
information over the Internet, is IPv4.
• The IPv4 specification dates back to the 1970’s.
• It has limitations in the area of limited IP addresses and
lack of security.
• IPv4 specifies a 32-bit IP address field, which will be
running out of available address space in the near future.
• Especially taking into consideration the new mobile
devices/internet appliances that will be connected to the
Internet in the near future, we have to go for IPv6 or Ipng.
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 18
Header Format- IPv6
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 19
IPV6 Datagram structure
➢ Version (4 bits): First field identifies the version number
of IP. Current version is IPV6
➢ Priority (4 bits): 4- bit priority field defines the priority of
packet with respect to traffic congestion.
➢ Flow Label (20 bits): Used by host to label those packets
for which it is requesting special handling by routers
within a network
➢ Payload length (16 bits): Length of the remainder of the
IPv6 packet following the header in octets.
➢ Next Header(8 bits): Identifies the type of header
immediately following the IPv6 header; this will be either
IPv6 extension header or a higher layer header such as
TCP or UDP. This field is called protocol field in version 4.
CN 621 Prof. Suresh Sankaranarayanan 2/2/2025 20