TCP Paper
TCP Paper
14
Ans.
The acronym ARP stands for Address Resolution Protocol which is one of the most important protocols of the
Data link layer in the OSI model. It is responsible to find the hardware address of a host from a known IP address.
There are three basic ARP terms.
ARP finds the hardware address, also known as the Media Access Control (MAC) address, of a host from its known
IP address.
How ARP Works?
Imagine a device that wants to communicate with others over the internet. What does ARP do? It broadcast a packet
to all the devices of the source network. The devices of the network peel the header of the data link layer from
the Protocol Data Unit (PDU) called frame and transfer the packet to the network layer (layer 3 of OSI) where the
network ID of the packet is validated with the destination IP’s network ID of the packet and if it’s equal then it
responds to the source with the MAC address of the destination, else the packet reaches the gateway of the network
and broadcasts packet to the devices it is connected with and validates their network ID. The above process
continues till the second last network device in the path reaches the destination where it gets validated and ARP, in
turn, responds with the destination MAC address.
1. ARP Cache: After resolving the MAC address, the ARP sends it to the source where it is stored in a table for
future reference. The subsequent communications can use the MAC address from the table.
2. ARP Cache Timeout: It indicates the time for which the MAC address in the ARP cache can reside.
3. ARP request: This is nothing but broadcasting a packet over the network to validate whether we came across
the destination MAC address or not.
1. The physical address of the sender.
2. The IP address of the sender.
3. The physical address of the receiver is FF:FF:FF:FF:FF: FF or 1’s.
4. The IP address of the receiver.
4. ARP response/reply: It is the MAC address response that the source receives from the destination which aids
in further communication of the data.
CASE-1:
The sender is a host and wants to send a packet to another host on the same network.
Use ARP to find another host’s physical address.
CASE-2:
The sender is a host and wants to send a packet to another host on another network.
The sender looks at its routing table.
Find the IP address of the next hop (router) for this destination.
Find the IP address of the next hop (router) for this destination.
CASE-3:
The sender is a router and received a datagram destined for a host on another network.
The router checks its routing table.
Find the IP address of the next router.
Use ARP to find the next router’s physical address.
CASE-4:
The sender is a router that has received a datagram destined for a host in the same network.
Use ARP to find this host’s physical address.
Note: An ARP request is broadcastand an ARP response is a Unicast.
To make sure that each message reaches its target location intact, the TCP/IP model breaks down the data into small
bundles and afterward reassembles the bundles into the original message on the opposite end. Sending the
information in little bundles of information makes it simpler to maintain efficiency as opposed to sending
everything in one go.
After a particular message is broken down into bundles, these bundles may travel along multiple routes if one route
is jammed but the destination remains the same.
For example, When a user requests a web page on the internet, somewhere in the world, the server processes that
request and sends back an HTML Page to that user. The server makes use of a protocol called the HTTP Protocol.
The HTTP then requests the TCP layer to set the required connection and send the HTML file.
Now, the TCP breaks the data into small packets and forwards it toward the Internet Protocol (IP) layer. The
packets are then sent to the destination through different routes.
The TCP layer in the user’s system waits for the transmission to get finished and acknowledges once all packets
have been received.
Features of TCP/IP
What is FTP?
The term FTP is a short form for File Transfer Protocol. FTP is a type of internet standard that basically allows
different devices (computers) to upload as well as download data files on the internet. The FTP sites consist of various
types of files (images, video, texts, graphics, etc.). The FTP files came into existence when data security was not the
primary concern. FTP is now pretty old, and various news protocols have now replaced it.
The FTP provides support for two types of Transmission Control Protocols (TCP)- the first one is the data port or data
connection (port 20) for transferring files. The second one here is the command port or control connection (port 21)
for the authentication of the user.
What is HTTP?
The term HTTP is a short form for HyperText Transfer Protocol. HTTP is basically the backbone of the world wide
web (WWW). It is basically an internet standard that assists in the process of transferring various web pages all over
the internet. HTTP helps in defining how a web browser responds to all of its web requests.
All the web addresses of the web pages consist of a domain name and protocol along with their path to the main web
page. A majority of the web addresses consist of http:// in their respective URLs that show the HTTP protocol.
The working of HTTP is basically like the combined functions of SMTP and FTP. Also, HTTP makes use of the TCP.
Full-Form The term FTP is a short form for File The term HTTP is a short form for HyperText
Transfer Protocol. Transfer Protocol.
Meaning FTP refers to the set of rules that basically HTTP refers to a set of rules that determines
allows the process of uploading and the process of transfer of various web pages
downloading files from a computer to the over various computers present on the
internet. internet.
Support It provides support for the control It provides support for the connection of data.
connection as well as the data connection.
Use of TCP It makes use of the TCP. The FTP runs on It also makes use of the TCP. The HTTP runs
port 20 and port 21 of TCP. on port 80 of TCP.
Nature of URLs The URLs that use the FTP protocol begin The URLs that use the HTTP protocol begin
with FTP. with HTTP.
Requirement of It always requires authentication. The HTTP requires no authentication.
Authentication
Efficiency of File It can easily transfer large files with chunks It is capable of efficiently transferring various
Transfer of data. small files.
Utilization of The computers that receive the transferred The files that a computer/ device receives
Computer Memory files via the internet save them in their over the internet do not get saved in its
memory. memory.
Maintenance of This protocol is not stateless. Thus, it This protocol is stateless in nature.
States maintains the state.
Type of Band HTTP provides support for an out-band FTP provides support for an in-band type of
Transfer type of transfer. transfer.
Uses We use FTP for downloading as well as We use HTTP for providing various web
uploading files between a server and a pages from the web browser to the web
client over the internet. server.
Type of TCP FTP makes use of a persistent connection of HTTP can easily make use of both- persistent
Connection TCP for its control connection and a non- as well as the non-persistent type of TCP
persistent one for its data connection. connection.
HUB SWITCH
Hub is a half duplex transmission mode. While switch is a full duplex transmission mode.
In hub, Packet filtering is not provided. While in switch, Packet filtering is provided.
Hub is not an intelligent device that sends message to While switch is an intelligent device that sends
all ports hence it is comparatively inexpensive. message to selected destination so it is expensive.
Hub is simply old type of device and is not generally While switch is very sophisticated device and widely
used. used.
Hacking of systems attached to hub is complex. Hacking of systems attached to switch is little easy.
VLAN tagging: VLAN tagging is a way to identify and distinguish VLAN traffic from other network
traffic. This is typically done by adding a VLAN tag to the Ethernet frame header.
VLAN membership: VLAN membership determines which devices are assigned to which VLANs.
Devices can be assigned to VLANs based on port, MAC address, or other criteria.
VLAN trunking: VLAN trunking allows multiple VLANs to be carried over a single physical link.
This is typically done using a protocol such as IEEE 802.1Q.
VLAN management: VLAN management involves configuring and managing VLANs, including
assigning devices to VLANs, configuring VLAN tags, and configuring VLAN trunking.
Types of connections in VLAN –
There are three ways to connect devices on a VLAN, the type of connections are based on the connected devices i.e.
whether they are VLAN-aware(A device that understands VLAN formats and VLAN membership) or VLAN-
unaware(A device that doesn’t understand VLAN format and VLAN membership).
1. Trunk Link –
All connected devices to a trunk link must be VLAN-aware. All frames on this should have a special
header attached to it called tagged frames.
2. Access link –
It connects VLAN-unaware devices to a VLAN-aware bridge. All frames on the access link must be
untagged.
3. Hybrid link –
It is a combination of the Trunk link and Access link. Here both VLAN-unaware and VLAN-aware
devices are attached and it can have both tagged and untagged frames.
(a) Explain ARP Packet format with Diagram.
Ans ARP is a communication mechanism that is used to translate a network address, such as an IP address, to a
physical (MAC) address on a local network. ARP packets are transmitted and received on a network to achieve
this mapping. An ARP packet’s format, also known as an ARP packet header, has numerous fields required to
describe the type of ARP message, the addresses being resolved, and other communication-related information.
ARP Packet Format
The ARP packet format is used for ARP requests and replies and consists of multiple fields including hardware
type, protocol type, hardware and protocol size, operation, sender and target hardware, and IP addresses. These
fields work together to help devices on a network find and communicate with each other.
(b)
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.
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.
Ans The ICMP stands for Internet Control Message Protocol. It is a network layer protocol. It is used for error
handling in the network layer, and it is primarily used on network devices such as routers. As different types of errors
can exist in the network layer, so ICMP can be used to report these errors and to debug those errors.
For example, some sender wants to send the message to some destination, but the router couldn't send the message to
the destination. In this case, the router sends the message to the sender that I could not send the message to that
destination.
The IP protocol does not have any error-reporting or error-correcting mechanism, so it uses a message to convey the
information. For example, if someone sends the message to the destination, the message is somehow stolen between
the sender and the destination. If no one reports the error, then the sender might think that the message has reached the
destination. If someone in-between reports the error, then the sender will resend the message very quickly.
Position of ICMP in the network layer
Messages
o Error-reporting messages
The error-reporting message means that the router encounters a problem when it processes an IP packet then it reports
a message.
o Query messages
The query messages are those messages that help the host to get the specific information of another host. For example,
suppose there are a client and a server, and the client wants to know whether the server is live or not, then it sends the
ICMP message to the server.
The message format has two things; one is a category that tells us which type of message it is. If the message is of
error type, the error message contains the type and the code. The type defines the type of message while the code
defines the subtype of the message.
Ans
IPv4 IPv6
IPv4 has a 32-bit address length IPv6 has a 128-bit address length
In IPv4 Packet flow identification is not In IPv6 packet flow identification are Available and uses the
available flow label field in the header
In IPv4 Encryption and Authentication facility In IPv6 Encryption and Authentication are provided
not provided
IPv4 can be converted to IPv6 Not all IPv6 can be converted to IPv4
Example of IPv6:
Example of IPv4: 66.94.29.13
2001:0000:3238:DFE1:0063:0000:0000:FEFB
IPv4 short for Internet Protocol Version 4 is the fourth version of the Internet Protocol (IP).
IP is responsible to deliver data packets from the source host to the destination host.
This delivery is solely based on the IP Addresses in the packet headers.
IPv4 is the first major version of IP.
IPv4 is a connectionless protocol for use on packet-switched networks.
IPv4 Header-
The following diagram represents the IPv4 header-
1. Version-
Version is a 4 bit field that indicates the IP version used.
The most popularly used IP versions are version-4 (IPv4) and version-6 (IPv6).
Only IPv4 uses the above header.
So, this field always contains the decimal value 4.
NOTES
It is important to note-
Datagrams belonging to different versions have different structures.
So, they are parsed differently.
IPv4 datagrams are parsed by version-4 parsers.
IPv6 datagrams are parsed by version-6 parsers.
2. Header Length-
Header length is a 4 bit field that contains the length of the IP header.
It helps in knowing from where the actual data begins.
Minimum And Maximum Header Length-
The length of IP header always lies in the range-
[20 bytes , 60 bytes]
The initial 5 rows of the IP header are always used.
So, minimum length of IP header = 5 x 4 bytes = 20 bytes.
The size of the 6th row representing the Options field vary.
The size of Options field can go up to 40 bytes.
So, maximum length of IP header = 20 bytes + 40 bytes = 60 bytes.
Concept of Scaling Factor-
Header length is a 4 bit field.
So, the range of decimal values that can be represented is [0, 15].
But the range of header length is [20, 60].
So, to represent the header length, we use a scaling factor of 4.
3. Type Of Service-
Type of service is a 8 bit field that is used for Quality of Service (QoS).
The datagram is marked for giving a certain treatment using this field.
4. Total Length-
Total length is a 16 bit field that contains the total length of the datagram (in bytes).
Minimum total length of datagram = 20 bytes (20 bytes header + 0 bytes data)
Maximum total length of datagram = Maximum value of 16 bit word = 65535 bytes
5. Identification-
Identification is a 16 bit field.
It is used for the identification of the fragments of an original IP datagram.
When an IP datagram is fragmented,
Each fragmented datagram is assigned the same identification number.
This number is useful during the re assembly of fragmented datagrams.
It helps to identify to which IP datagram, the fragmented datagram belongs to.
6. DF Bit-
DF bit stands for Do Not Fragment bit.
Its value may be 0 or 1.
When DF bit is set to 0,
It grants the permission to the intermediate devices to fragment the datagram if required.
When DF bit is set to 1,
It indicates the intermediate devices not to fragment the IP datagram at any cost.
If network requires the datagram to be fragmented to travel further but settings does not allow its
fragmentation, then it is discarded.
An error message is sent to the sender saying that the datagram has been discarded due to its settings.
7. MF Bit-
MF bit stands for More Fragments bit.
Its value may be 0 or 1.
When MF bit is set to 0,
It indicates to the receiver that the current datagram is either the last fragment in the set or that it is the only
fragment.
When MF bit is set to 1,
It indicates to the receiver that the current datagram is a fragment of some larger datagram.
More fragments are following.
MF bit is set to 1 on all the fragments except the last one.
8. Fragment Offset-
Fragment Offset is a 13 bit field.
It indicates the position of a fragmented datagram in the original unfragmented IP datagram.
The first fragmented datagram has a fragment offset of zero.
9. Time To Live-
Time to live (TTL) is a 8 bit field.
It indicates the maximum number of hops a datagram can take to reach the destination.
The main purpose of TTL is to prevent the IP datagrams from looping around forever in a routing loop.
he value of TTL is decremented by 1 when-
Datagram takes a hop to any intermediate device having network layer.
Datagram takes a hop to the destination.
If the value of TTL becomes zero before reaching the destination, then datagram is discarded.
10. Protocol-
Protocol is a 8 bit field.
It tells the network layer at the destination host to which protocol the IP datagram belongs to.
In other words, it tells the next level protocol to the network layer at the destination side.
Protocol number of ICMP is 1, IGMP is 2, TCP is 6 and UDP is 17.
or
Version: the first field tells us which IP version we are using, only IPv4 uses this header so you will always
find decimal value 4 here.
Header Length: this 4 bit field tells us the length of the IP header in 32 bit increments. The minimum length
of an IP header is 20 bytes so with 32 bit increments, you would see value of 5 here. The maximum value we
can create with 4 bits is 15 so with 32 bit increments, that would be a header length of 60 bytes. This field is
also called the Internet Header Length (IHL).
Type of Service: this is used for QoS (Quality of Service). There are 8 bits that we can use to mark the packet
which we can use to give the packet a certain treatment. You can read more about this field in my IP
precedence and DSCP lesson.
Total Length: this 16-bit field indicates the entire size of the IP packet (header and data) in bytes. The
minimum size is 20 bytes (if you have no data) and the maximum size is 65.535 bytes, that’s the highest value
you can create with 16 bits.
Identification: If the IP packet is fragmented then each fragmented packet will use the same 16 bit
identification number to identify to which IP packet they belong to.
IP Flags: These 3 bits are used for fragmentation:
o The first bit is always set to 0.
o The second bit is called the DF (Don’t Fragment) bit and indicates that this packet should not be
fragmented.
o The third bit is called the MF (More Fragments) bit and is set on all fragmented packets except the
last one.
Fragment Offset: this 13 bit field specifies the position of the fragment in the original fragmented IP packet.
Time to Live: Everytime an IP packet passes through a router, the time to live field is decremented by 1.
Once it hits 0 the router will drop the packet and sends an ICMP time exceeded message to the sender. The
time to live field has 8 bits and is used to prevent packets from looping around forever (if you have a routing
loop).
Protocol: this 8 bit field tells us which protocol is enapsulated in the IP packet, for example TCP has value 6
and UDP has value 17.
Header Checksum: this 16 bit field is used to store a checksum of the header. The receiver can use the
checksum to check if there are any errors in the header.
Source Address: here you will find the 32 bit source IP address.
Destination Address: and here’s the 32 bit destination IP address.
IP Option: this field is not used often, is optional and has a variable length based on the options that were
used. When you use this field, the value in the header length field will increase. An example of a possible
option is “source route” where the sender requests for a certain routing path.
The error reporting messages are broadly classified into the following categories:
o Destination unreachable
The destination unreachable error occurs when the packet does not reach the destination. Suppose the sender sends the
message, but the message does not reach the destination, then the intermediate router reports to the sender that the
destination is unreachable.
The above diagram shows the message format of the destination unreachable message. In the message format:
Type: It defines the type of message. The number 3 specifies that the destination is unreachable.
Code (0 to 15): It is a 4-bit number which identifies whether the message comes from some intermediate router or the
destination itself.
Note: If the destination creates the destination unreachable message then the code could be either 2 or 3.
Sometimes the destination does not want to process the request, so it sends the destination unreachable message to the
source. A router does not detect all the problems that prevent the delivery of a packet.
o Source quench
There is no flow control or congestion control mechanism in the network layer or the IP protocol. The sender is
concerned with only sending the packets, and the sender does not think whether the receiver is ready to receive those
packets or is there any congestion occurs in the network layer so that the sender can send a lesser number of packets,
so there is no flow control or congestion control mechanism. In this case, ICMP provides feedback, i.e., source
quench. Suppose the sender resends the packet at a higher rate, and the router is not able to handle the high data rate.
To overcome such a situation, the router sends a source quench message to tell the sender to send the packet at a lower
rate.
The above diagram shows the message format of the source quench message. It is a type 4 message, and code is zero.
Note: A source quench message informs the sender that the datagram has been discarded due to the congestion
occurs in the network layer.
So, the sender must either stop or slow down the sending of datagrams until the congestion is reduced. The router
sends one source-quench message for each datagram that is discarded due to the congestion in the network layer.
o Time exceeded
Sometimes the situation arises when there are many routers that exist between the sender and the receiver. When the
sender sends the packet, then it moves in a routing loop. The time exceeded is based on the time-to-live value. When
the packet traverses through the router, then each router decreases the value of TTL by one. Whenever a router
decreases a datagram with a time-to-live value to zero, then the router discards a datagram and sends the time
exceeded message to the original source.
Each of the MAC layers has different data units. For example, some layers can handle upto 1500 data units, and some
can handle upto 300 units. When the packet is sent from a layer having 1500 units to the layer having 300 units, then
the packet is divided into fragments; this process is known as fragmentation. These 1500 units are divided into 5
fragments, i.e., f1, f2, f3, f4, f5, and these fragments reach the destination in a sequence. If all the fragments are not
reached to the destination in a set time, they discard all the received fragments and send a time-exceeded message to
the original source.
In the case of fragmentation, the code will be different as compared to TTL. Let's observe the message format of time
exceeded.
The above message format shows that the type of time-exceeded is 11, and the code can be either 0 or 1. The code 0
represents TTL, while code 1 represents fragmentation. In a time-exceeded message, the code 0 is used by the routers
to show that the time-to-live value is reached to zero.
The code 1 is used by the destination to show that all the fragments do not reach within a set time.
Parameter problems
The router and the destination host can send a parameter problem message. This message conveys that some
parameters are not properly set.
The above diagram shows the message format of the parameter problem. The type of message is 12, and the code can
be 0 or 1.
When the packet is sent, then the routing table is gradually augmented and updated. The tool used to
achieve this is the redirection message. For example, A wants to send the packet to B, and there are two
routers exist between A and B. First, A sends the data to the router 1. The router 1 sends the IP packet to
router 2 and redirection message to A so that A can update its routing table.
Type:
0x11 for Membership Query
0x12 for IGMPv1 Membership Report
0x16 for IGMPv2 Membership Report
0x22 for IGMPv3 Membership Report
0x17 for Leave Group
Max Response Time – This field is ignored for message types other than membership query. For
membership query type, it is the maximum time allowed before sending a response report. The value is
in units of 0.1 seconds.
Checksum – It is the one’s complement of the sum of IGMP message.
Group Address – It is set as 0 when sending a general query. Otherwise, multicast address for group-
specific or source-specific queries.
3. IGMPv3 : IGMPv2 was revised to IGMPv3 and added source-specific multicast and membership report
aggregation. These reports are sent to 224.0.0.22. The message packet format in IGMPv3:
Max Response Time – This field is ignored for message types other than membership query. For
membership query type, it is the maximum time allowed before sending a response report. The value is
in units of 0.1 seconds.
Checksum – It is the one’s complement of the one’s complement of the sum of IGMP message.
Group Address – It is set as 0 when sending a general query. Otherwise, multicast address for group-
specific or source-specific queries.
Resv – It is set zero of sent and ignored when received.
S flag – It represents Suppress Router-side Processing flag. When the flag is set, it indicates to suppress
the timer updates that multicast routers perform upon receiving any query.
QRV – It represents Querier’s Robustness Variable. Routers keeps on retrieving the QRV value from
the most recently received query as their own value until the most recently received QRV is zero.
QQIC – It represents Querier’s Query Interval Code.
Number of sources – It represents the number of source addresses present in the query. For general
query or group-specific query, this field is zero and for group-and-source-specific query, this field is
non-zero.
Source Address[i] – It represents the IP unicast address for N fields.
Working: IGMP works on devices that are capable of handling multicast groups and dynamic multicasting. These
devices allows the host to join or leave the membership in the multicast group. These devices also allows to add and
remove clients from the group. This communication protocol is operated between host and local multicast router.
When a multicast group is created, the multicast group address is in range of class D (224-239) IP addresses and is
forwarded as destination IP address in the
packet.
L2 or Level-2 devices such as switches are used in between host and multicast router for IGMP snooping. IGMP
snooping is a process to listen to the IGMP network traffic in controlled manner. Switch receives the message from
host and forwards the membership report to the local multicast router. The multicast traffic is further forwarded to
remote routers from local multicast routers using PIM (Protocol Independent Multicast) so that clients can receive
the message/data packets. Clients wishing to join the network sends join message in the query and switch intercepts
the message and adds the ports of clients to its multicast routing table.
Advantages:
IGMP communication protocol efficiently transmits the multicast data to the receivers and so, no junk
packets are transmitted to the host which shows optimized performance.
Bandwidth is consumed totally as all the shared links are connected.
Hosts can leave a multicast group and join another.
Disadvantages:
It does not provide good efficiency in filtering and security.
Due to lack of TCP, network congestion can occur.
IGMP is vulnerable to some attacks such as DOS attack (Denial-Of-Service).