Protocols
Protocols
• Hierarchy in Addressing:
• In any communication network that involves delivery, such as a telephone network or a postal
network, the addressing system is hierarchical.
• In a postal network, the postal address includes the country, state, city, street, house number
• A 32-bit IPv4 address is also hierarchical, but divided into two parts.:
• The first part of the address, called the prefix, defines the network;
• the second part of the address, called the suffix, defines the node(host)
• A prefix can be fixed length( Classful Addressing) or variable length ( Classless Addressing)
IPv4 Addressing:Classful Addressing
• In classful addressing address space is divided into five classes :class A, B, C, D, and E
• In class A, one byte defines the netid (prefix) and three bytes define the hostid (suffix).
• In class B, two bytes define the netid and two bytes define the hostid.
• In class C, three bytes define the netid and one byte defines the hostid.
IPv4 Addressing:Classful Addressing
• In classful addressing each class is divided into a fixed number of blocks with
each block having a fixed size as shown in Table.
• Subnet Mask:
• The purpose of subnet mask is to identify which part of an IP address is network
part and which part is host part.
• Subnet mask is a 32 bit number created by setting network bits to all 1s and setting
host bits to all 0s.
• The last column of Table shows the mask in the form /n where n can be 8, 16, or 24 in classful
addressing.
• This notation is also called slash notation or Classless Interdomain Routing (CIDR) notation.
IPv4 Addressing:Classful Addressing:
Example: Find the error, if any, in the following IPv4
addresses.
Solution:
a. There must be no leading zero (045).
b. There can be no more than four bytes in IP address.
c. Each number needs to be less than or equal to 255.
d. A mixture of binary notation and dotted-decimal
notation is not allowed.
19.6
IPv4 Addressing:Classful Addressing:
Solution:
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C
address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
19.7
IPv4 Addressing:Classful Addressing
• In Classless addressing, the whole address space is divided into variable length blocks.
• The prefix in an address defines the block (network); the suffix defines the node (hosts).
• We can have a block of 1 address, 2 addresses, 4 addresses, 128 addresses, and so on.
• Restrictions on classless address blocks:
1. The addresses in block must contiguous , one after another.
2. The number of addresses in a block needs to be a power of 2.
3. The first address must be evenly divisible by the number of addresses.
IPv4 Addressing : Classless addressing
• Prefix Length: Slash Notation
• In classless addressing prefix length is variable.
• We can have a prefix length that ranges from 0 to 32.
• In classless address, the prefix length, n, is added to the address, separated by a slash.
• The notation is informally referred to as slash notation and formally as classless interdomain
routing or CIDR (pronounced cider) strategy
• An address in classless addressing can be represented as shown in Figure 18.20.
IPv4 Addressing: Classless addressing
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 0010000
or
205.16.37.32.
19.13
IPv4 Addressing: Classless addressing
19.14
IPv4 Addressing: Classless addressing
19.15
Example 19.9
Another way to find the first address, the last address, and
the number of addresses is to represent the mask as a 32-bit
binary number.
In Example 205.16.37.39/28
the /28 can be represented as
11111111 11111111 11111111 11110000
(twenty-eight 1s and four 0s).
Find
a. The first address
b. The last address
19.16
Example 19.9 (continued)
Solution
a. The first address can be found by ANDing the given
addresses with the mask. ANDing here is done bit by
bit. The result of ANDing 2 bits is 1 if both bits are 1s;
the result is 0 otherwise.
19.17
Example 19.9 (continued)
19.18
IPv4 Addressing : Classless addressing
• Special Addresses: are not assigned to any host in a network and are used for special
purposes:
• This-host Address :The only address in the block 0.0.0.0/32 is called the this-host address.
• It is used when host want to know its own IP address then host use this address as source
address in packet and send packet to Bootstrap server(DHCP server) .
• In a connection less service, the source does not makes any connection with the
destination.
• source sent a set of packets to destination without establishing connection with destination.
• In connection-less service, there is a no relationship between packets. Packets are sent on
the same path or on different path
Network Layer Protocols
• Internet Protocol version 4 (IPv4) is responsible for packetizing, forwarding, and
delivery of a packet at the network layer.
• The Internet Control Message Protocol version 4 (ICMPv4) helps IPv4 to handle some
errors that may occur in the network-layer delivery.
• The Internet Group Management Protocol (IGMP) is used to help IPv4 in multicasting.
• The Address Resolution Protocol (ARP) is used mapping network-layer addresses to
link-layer addresses. (it find MAC address of device from its IP address.)
• Figure 19.1 shows the positions of these four protocols in the TCP/IP protocol suite.
Internet Protocol(IP)
• IPv4 is an unreliable datagram protocol—a best-effort delivery service.
• The term best-effort means that IPv4 packets can be corrupted, be lost, arrive out of
order, or be delayed, and may create congestion for the network.
• If reliability is important, IPv4 must be paired with a reliable protocol such as TCP.
• An example of best-effort delivery service is the post office.
• The post office does its best to deliver the letters but does not always succeed.
• IPv4 is also a connectionless protocol that uses the datagram approach.
• Datagram approach means that each datagram is handled independently, and each
datagram can follow a different route to the destination.
Internet Protocol(IP) :Datagram format
• Datagram format: Packets used by IP are called datagram
• A datagram is a variable-length packet consisting of two parts: header and payload (data).
• The size of datagram is 20 to 65535 bytes
• The header is same as envelope of letter
• The Header consists information necessary for routing and delivery of packet.
• The size of header is 20 to 60 bytes
Internet Protocol(IP) :Datagram format
• Datagram format fields:
• Version Number(4 bits):it defines the version of the IPv4 protocol, In this case version of IP
protocol is 4.
• Header Length(4 bits): it defines the length of IP datagram header.
• The minimum length of header is 20 bytes and maximum length of header is 60 bytes
• Total Length (16-bit) :it defines the total length of IP datagram including header and data.
Total length 216 =65536
Total length = Header length+ payload(data) length.
payload(data) length = Total length – Header length.
Internet Protocol(IP) :Datagram format
• Datagram format fields:
• Service Type(8-bit) : IETF(Internet Engineering Task Force) has changed the interpretation
and name of this field. This field, previously called service type, is now called differentiated
service
• Header checksum (16 bit): It consist checksum value for checking errors in the datagram
header.
• Source Addresses (32-bit) : it defines the IP address of the source.
• Destination Addresses (32-bit) : it defines the IP address of the destination.
• Source Quench:
• source quench message informs the sender that the network has encountered congestion and
the datagram has been dropped; the source needs to slow down sending more datagrams.
ICMPv4: Error Reporting Messages
• Redirection Message:
• It’s used when the source uses a wrong router to send out its packet then router forwards
packet to appropriate router and sends redirection message to source ,to informs the source to
update its routing table.
• The IP address of the default router is sent in the message.
• Parameter Problem :
• When router detects problem in the header of a datagram or some options of header are
missing then router sends the “Parameter Problem” message to source.
ICMPv4: Error Reporting Messages
• Time exceeded message: Time exceeded message informs the source, datagram is
discarded due to the time to live field value reached zero.
ICMPv4: Query Messages
• Query Messages:
• query messages come in pairs: request and reply.
• The echo request and echo reply pair of messages are used by a host to test
another host is alive or not.
• The host sends echo request message to another host ,if the another host is
alive ,then it responds with an echo reply message.
• Checksum Testing:
1. The sum of all words (header and data)is calculated.
2. The sum is complemented.
3. If the result obtained in step 2 is 16 0s, the message is accepted ; otherwise, it is
rejected.
ICMPv4 : Checksum
• Example:Figure 19.11 shows an example of checksum calculation for a simple echo-request
message. We randomly chose the identifier to be 1 and the sequence number to be 9. The
message is divided into 16-bit (2-byte) words. The words are added and the sum is
complemented. Now the sender can put this value in the checksum field.
ARP
• It is Internet layer of TCP/IP model.
• It is used to map an IP address to physical address known as MAC address.
• It is essential for communication within a local network as data needs to be
delivered to a specific device’s hardware address on that network segment.
• Mapping IP address to MAC address
Working of ARP
• It is used in IPV4 networks.
• When a device wants to communicate with another device on the same
local network, it uses ARP to determine the destination device’s MAC
address.
Step by step process:
• ARP Request
• ARP Reply
• Updating ARP cache
• Data transmission
Step by step process
• ARP Request : When device (Host X)needs to send data to another
device(Host Y) on the local network it checks its ARP cache.(IP to MAC
address mapping).
• If Host X doesn’t have Host Y’S MAC address in it’s ARP cache , it broadcast
an ARP request packet on the network asking who has IP address X.X.X.X?
• ARP Reply: All devices on the local network receive the ARP request but only
Host Y recognizes its IP address in the request.
• Host Y sends an ARP reply back to host X with its MAC address.
• Updating ARP cache : Host X receives the ARP Reply and updates ARP cache
with the IP to MAC mapping for Host Y, allowing Host X to use information
for future communication
Step by step process
• Data Transmission: With MAC address now known, Host X encapsulates the
data into a frame with Host Y’s MAC address as destination and send it over
the network.
Message Format
Message Format
• Hardware type: This is 16 bits field defining the type of the network
on which ARP is running. Ethernet is given type 1.
• Protocol type: This is 16 bits field defining the protocol. The value of
this field for the IPv4 protocol is 0800H.
• Hardware length: This is an 8 bits field defining the length of the
physical address in bytes. Ethernet is the value 6.
• Protocol length: This is an 8 bits field defining the length of the logical
address in bytes. For the IPv4 protocol, the value is 4.
• Operation (request or reply): This is a 16 bits field defining the type
of packet. Packet types are ARP request (1), and ARP reply (2).
• Sender hardware address: This is a variable length field defining the
physical address of the sender. For example, for Ethernet, this field is 6
bytes long.
Message Format
• Sender protocol address: This is also a variable length field defining
the logical address of the sender For the IP protocol, this field is 4 bytes
long.
• Target hardware address: This is a variable length field defining the
physical address of the target. For Ethernet, this field is 6 bytes long.
For the ARP request messages, this field is all Os because the sender
does not know the physical address of the target
• Target protocol address: This is also a variable length field defining the
logical address of the target. For the IPv4 protocol, this field is 4 bytes long.
ARP Message Field
• Target protocol address
• Sender protocol address
• Protocol size(1 byte)
• Opcode (2 bytes)
• Target hardware address(6 bytes)
• Sender hardware address(6 bytes)
• Protocol Type(2 bytes)
• Hardware type(2 bytes)
• Hardware size(1 byte)
Advantages & disadvantages Of ARP
Advantages
• Efficiency
• Network communication
Disadvantages
• Spoofing
• Poisoning
• Excessive broadcast traffic
RARP
• It is used to link MAC address with an IP address. Reverse Address Resolution
Protocol.
• It maps an IP address to MAC address.
• It is used to allow a device typically a diskless workstation or device without a
preconfigured IP address, to obtain its IP address from a network server using
its only its MAC address.
• It performs in a way that is exactly opposite to that of the ARP.
• With RARP, the device would broadcast its MAC address and request an IP
address, and a RARP server on the network would respond with the
corresponding IP address
Message Format Of RARP
Message Format Of RARP
• Hardware Address Type : It is 2-byte field. It is type of hardware MAC
address present in the packet. For Ethernet, the value of this field is 1.
• Protocol Address Type (PTYPE): It is 2 byte field. It is type of the protocol
address requested for the MAC address. For IP address the value of this field is
0*100.
• Hardware length(HLEN): It is 1-byte field. It indicates the size of the
hardware MAC address. For Ethernet, the value of this field is 6.
• Protocol length(PLEN): It is 1 byte field. It indicates the size of the
protocol address. For IP, the value of this field is 4.
Advantages:
• TCP supports multiple routing protocols.
• TCP protocol operates independently of that of the operating system.
• TCP protocol provides the features of error control and flow control.
• TCP provides a connection-oriented protocol and provides the delivery of data
Disadvantages:
• TCP protocol cannot be used for broadcast or multicast transmission.
• TCP protocol has no block boundaries.
• No clear separation is being offered by TCP protocol between its interface,
services, and protocols.
• In TCP/IP replacement of protocol is difficult.
UDP
• UDP stands for User Datagram Protocol.
• User Datagram Protocol provides a nonsequential transmission of data. It is a
connectionless transport protocol.
• UDP protocol is used in applications where the speed and size of data
transmitted is considered as more important than the security and reliability.
User Datagram is defined as a packet produced by User Datagram Protocol.
UDP protocol adds checksum error control, transport level addresses, and
information of length to the data received from the layer above it.
• Services provided by User Datagram Protocol(UDP) are connectionless
service, faster delivery of messages, checksum, and process-to-process
communication.
UDP Segment
• While the TCP header can range from 20 to 60 bytes, the UDP header is a
fixed, basic 8 bytes.
UDP Segment
• Source Port: Source Port is a 2 Byte long field used to identify the port
number of the source.
• Destination Port: This 2-byte element is used to specify the packet's
destination port.
• Length: The whole length of a UDP packet, including the data and header. The
field has sixteen bits.
• Cheksum: The checksum field is used for error checking of the header and
data.
Advantages & disadvantages of UDP
Advantages:
• UDP also provides multicast and broadcast transmission of data.
• UDP protocol is preferred more for small transactions such as DNS lookup.
• It is a connectionless protocol, therefore there is no compulsion to have a
connection-oriented network.
• UDP provides fast delivery of messages.
Disadvantages:
• In UDP protocol there is no guarantee that the packet is delivered.
• UDP protocol suffers from worse packet loss.
• UDP protocol has no congestion control mechanism.
• UDP protocol does not provide the sequential transmission of data.