Suppose two persons are to
communicate with one another. To communicate successfully, they
should be sharing a common language. Therefore, both ends should be able to
understand what the other person is saying.
Similarly, in computer networks, the computers
should be sharing a common message format.
They should know how long the message
is? Which part of the message is the actual data? Which part of the message
is the sender's and receiver's address? Such information will result in successful
communication between computers.
If one computer speaks ASCII and the other
speaks Unicode, successful communication will not occur unless they are prepared to
perform the translations back and forth.
So, some ground rules are required
to communicate successfully.
In computer networks, the agreed-upon set
of ground rules that make communication possible are called protocols.
TCP/IP is a set of protocols that support network communication, but what is
a network and what is communication?
In the most basic form, two computers
connected via LAN Cable sharing data with the help of Network Interface Cards (hardware
present in each computer) forms a network, and the process of sending messages from
one place to another through a wired or wireless medium is called communication.
The message can be a file, a voice conversation, a streaming video or anything which can
be communicated in digital form.
These messages are not sent
as a single unit; instead, they are broken into small data units. These
data units are transmitted through the network and restored at the receiver
into the original message.
In TCP/IP protocol suite, TCP breaks messages
into small data units called segments and hands them off to IP, which deals with routing segments
through the networks to their final destination. TCP module in the receiver combines the
segments to form the original message.
Note that TCP stands for Transmission Control
Protocol and IP stands for Internet Protocol. An alternative to TCP is UDP. It stands for User
Datagram Protocol. The main difference is that TCP is highly reliable, but it is slow, whereas UDP
is less reliable but generally faster. Both TCP and UDP are a part of the protocol suite.
However, due to heavy dependence on TCP, and for historical reasons, the entire set
of protocols is referred to as TCP/IP.
TCP/IP is a network model designed to support
network communication, even if the computers are from different manufacturers. There is one
more network model called the OSI model or Open System Interconnection reference model. It
is primarily used for research. On the other hand, TCP/IP is a practical model developed to meet
the needs of the original Internet design.
As per the name, TCP/IP seems to be a set
of two protocols only – TCP and IP. However, it consists of numerous protocols
bundled at different layers.
The topmost layer is the Application layer which
generates a message. The message is passed to the lower layers at the sending node, where each layer
encapsulates the message from the above layer. So, the message sent becomes larger and
larger as it passes down the chain.
The data unit in the data link
layer is called an Ethernet frame; in the network layer, it is called an IP
packet; if it is in the transport layer, it is called TCP segment in case of TCP protocol,
and UDP datagram in case of UDP protocol. In the application layer, it is
called an application message.
The peer layer removes the header at the
receiving node and passes the remainder upwards layer-by-layer till the message
finally reaches the application layer.
Let us discuss each layer
one-by-one in more detail.
We are starting with the bottom-most
layer – the physical layer.
The physical layer is the place where
actual communication takes place. We know that a sequence of 0s and 1s
digitally represents the messages. The physical layer converts this binary sequence
into signals and transmits them over local media. The signal can be electrical if the
local media is Copper Cable or LAN cable, the Light signal in case of Optical Fiber
and a Radio signal in case of Air/Vacuum.
So, the signal generated by the Physical Layer depends on the type of media
used to connect two devices.
The most common protocol used at
the physical layer is Ethernet. The protocol also specifies the type of
cables that can be used for data transmission. For example, if the protocol used is Ethernet,
then twisted pair cable, coaxial cable, or fiber optic cable can be used for data transmission.
If the protocol used is fast Ethernet or gigabit ethernet, then twisted pair or fiber optic
cable can be used as local media.
Next is - THE DATA LINK LAYER
The data unit in the data link layer is called an Ethernet frame. The data
link layer is divided into two sublayers:
· Medium-access control or MAC sublayer, and
· Logical link control or LLC sub-layer
The MAC sublayer is responsible for
· Data encapsulation, and
· Accessing the media
In data encapsulation, the MAC sublayer adds a header and a trailer to
the IP packet received from the network layer. The header contains the MAC addresses
of the sender and receiver. The trailer contains 4 bytes of error checking data used to
detect errors in the received Ethernet frame.
What is the MAC address? It is a unique
6-byte address embedded in the NIC of a device by its manufacturer.
For accessing the media, the access method Ethernet uses is called Carrier Sense
Multiple Access/Collision Detection or CSMA/CD. In this method, each computer listens to the
cable before sending data through the network. If the network is clear, the computer will
transmit. If the first computer is already transmitting on the cable, the second computer
will wait and try again when the line is clear.
Sometimes, two computers attempt to transmit
at the same instant. When this happens, a collision occurs. Each computer then stops
transmission and waits a random amount of time before attempting to retransmit.
Please note, with this access method; it is normal to have collisions. However, the
delay caused by collisions and retransmitting is very small and does not normally affect
the speed of transmission on the network.
The next is the LLC sub-layer. It offers
· flow control, and
· error control
Flow control is a technique that restricts the amount of data that a sender can send without
overwhelming the receiver. The receiving devices have a limited processing speed and a limited
memory to store the incoming data. If these limits are exceeded, then the incoming data will be lost.
To avoid this, the receiver should inform the sender to slow down the transmission rate before
these limits are met. In the data link layer, flow control restricts the number of frames the sender
can send without overwhelming the receiver.
Error control in the data link layer primarily
refers to error detection and retransmission.
Error detection is done by using the error
checking bytes added in the trailer of the frame. The frame retransmission is done
using Automatic Repeat Request or ARQ. The receiver sends an ACK to
the sender when a frame is received. When the ACK is not received, the sender sends the
frame again. So, if a frame gets lost or damaged, then the ACK is not sent. As a result, the
sender sends the frame again. This process is called Automatic Repeat Request (ARQ).
LLC layer can also re-size the IP packets received from the network layer to fit
them in the data link layer frames.
The transport layer provides most
of the services of the LLC sublayer, including flow control, error control, and
sizing of packets; therefore, the services of the LLC layer are usually bypassed.
The remaining three layers of the TCP/IP protocol stack, including network,
transport, and application layers, are implemented as software programs
within the computer's operating system.
Starting with the NETWORK LAYER
The transport layer passes TCP segments or UDP datagrams to the Network Layer. The
network layer adds logical addresses or IP addresses to the TCP segments or UDP datagrams to
form IP packets and then uses routers to send the IP packets to other networks. The network layer
also determines the best path for data delivery. So the functions of the network layer are:
1. Logical Addressing
2. Routing
3. Path determination
IP is the single standard protocol for this
layer. The TCP/IP network layer is also called the internetworking layer or IP layer.
Logical Addressing: Every computer in a network has a unique IP address. The network layer
assigns sender and receiver's IP addresses to each segment or datagram to form an IP
Packet. IP addresses are assigned to ensure that each IP packet can reach the correct
destination present in different networks.
Routing
Routing is a method of moving an IP packet from source to
destination present in different networks. Routing is not needed if the source and destination
computers are present in the same network.
For communications within a
network, the task is usually simple. The ARP module takes the destination IP address
from the IP packet and returns the MAC address of the destination computer. It is then used
to create an Ethernet frame which is delivered directly to the destination as it is present
in the same network, . no routing is needed.
However, when the message is being sent to a node
outside a network, for example, to the Internet, the network layer moves the message from sender
to receiver through routers. Consider two networks connected with a router. Computer A needs to
send data to computer B. Please note that both computers are present in different networks.
Hence, in this case, routing is needed.
To create an Ethernet frame, we need the
MAC address of the destination computer. However, in this case, the destination is present
in a different network. So, the ARP module cannot provide us with the destination's MAC address
because it can provide the MAC address only if the computers are present in the same network. So,
the ARP module in network one cannot provide the MAC addresses of the computers present in network
two and vice-versa. Since the intermediate to the networks is the router R, the destination MAC
address is kept as the router's MAC address, and the frame is forwarded to the router. Router finds
that the MAC address in the frame matches its address. So, it extracts the IP packet from the
frame and forwards it to the network layer. The network layer finds a mismatch for the destination
IP address. So it sends the IP packet down to the data link layer and updates the destination
MAC address with the MAC address of computer B. But how router knows the MAC address of computer
B? Simple, by using the ARP module. It is one network, so the ARP module works here. Finally,
the ethernet frame is delivered to computer B. Please note that the destinations IP address
never changes for inter-network communication, but the physical address or the MAC
address changes with every hop.
So, IP addresses are a must to transfer
data among multiple networks.
Now Path determination:
A computer can be connected to an internet server or a computer in several
ways. Choosing the best possible path for data delivery from source to destination is called
Path Determination. Layer 3 devices use protocols such as OSPF (Open Shortest Path First), BGP
(Border Gateway Protocol), IS-IS (Intermediate System to Intermediate System) to determine
the best possible path for data delivery.
Because routing takes place at the network
layer or layer 3, routers and gateways are sometimes called layer three switches.
IP is unreliable. It does not guarantee delivery nor check for errors. These tasks are the
responsibility of the transport layer.
Let us start discussing the transport layer
At the sending node, the transport layer receives the message from the application layer.
When the message reaches the transport layer, one of the transport layer protocols,
i.e., TCP or UDP, is selected.
TCP supports segmentation. So, if the message
is large, TCP divides it into smaller pieces and adds a header to form a TCP segment.
On the other hand, UDP does not support segmentation, so the applications
using UDP should send messages short enough to fit into one UDP datagram.
Note that the data unit in TCP is called TCP segment, and the data unit in
UDP is called UDP datagram.
UDP datagrams are considered unreliable because
there is no guarantee that all datagrams sent will be received in the destination and in the
correct order. So, if reliability is needed, UDP should not be used.
UDP lacks error checking and correction. It makes UDP fast and efficient
for DNS, DHCP, SNMP, and RIP protocols. UDP is also suited for streaming videos.
When the application layer invokes the UDP protocol, UDP encapsulates the application
message into UDP datagrams. The datagram is then passed to the network layer for transmission.
At the receiving end, the network layer sends the UDP datagram to the transport layer. UDP then
extracts the application message from the datagram and passes it to the application layer.
TCP, on the other hand, is reliable and guarantees in-order delivery of data from the
sender to the receiver. The data transmission via TCP has three phases:
· Connection establishment
· Data transfer, and
· Connection termination
In the Connection Establishment phase, the sender
TCP or client sends a packet to the receiver TCP or server requesting a connection. The server then
sends an acknowledgement to the client. The client further acknowledges the server. It completes
the process of connection establishment. Since a connection is set up before data transmission,
TCP is a connection-oriented protocol, and the connection establishment process is
called Three-Way TCP Connection Handshake.
Once the connection is established,
the next phase is the Data Transfer. During data transfer, TCP offers some key features
which UDP does not provide, and it includes
• Error-free data transfer
• Ordered-data transfer
• Retransmission of lost data
• Discarding duplicate packets, and
• Congestion throttling
Let us discuss each feature one-by-one.
Error-Free Data Transfer is provided by using
the field Checksum. The sender calculates and enters a value in this field. At the receiving
end, the receiver performs the same process and calculates the checksum value. If it does
not match with the value present in the checksum field, the TCP segment is discarded, and no
ACK is sent to the sender. Because the sending side does not receive an acknowledgement of
the discarded packet, it is retransmitted.
Ordered-Data Transfer
TCP adds a sequence number in the TCP segments. At the receiving end, the TCP module uses the
sequence numbers to reconstruct the application message in the correct order.
Retransmission of Lost segments
For reliable data transfer, the receiver TCP sends
an acknowledgement to the sender TCP for each TCP segment it receives. If an acknowledgement is
not received, the TCP segment is retransmitted. Therefore, if a TCP segment is lost, the receiver
will not send an ACK message to the sender. As a result, the sender TCP
sends the lost segment again.
Discarding Duplicate segments
The TCP client retransmits packets that it determines to be lost. However, the receiver
TCP may receive segments that were considered to be lost after the sending side has retransmitted
the segments. As a result, the receiving end will have two or more copies of the same segment. In
such cases, the unique sequence numbers in the TCP header of every segment helps to determine the
duplicate segments, which are then discarded.
Congestion Throttling or flow control
The goal for TCP is to send segments to the receiving end as fast as possible without
losing them. When TCP first sends the segments, it sets a timer. If the segments are acknowledged
before the timer expires, TCP increases the transmission speed until the segments begin to
become unacknowledged. Since the ACK for some segments is not received within the time, the
sending TCP module retransmits the segments. When a significant number of packets have
to be retransmitted, TCP slows down the data transfer rate. In this way, TCP handles
congestion throttling or flow control.
The last phase in the data transmission
is Connection Termination.
When an endpoint wishes to stop its connection,
it sends a finished message to the other endpoint. The other end acknowledges the message. Both
ends do this two-phase handshake process. Therefore, the connection termination follows
a four-way handshake process.
The Top Most Layer in the
TCP/IP protocol suite is the
Application layer
The application layer is used by user applications
that pass messages from one computer to another in a network. For example, Internet Explorer, Google
Chrome, Firefox, Microsoft Outlook, and so on. Note that the user applications do not reside on
the application layer, but they use application layer protocols to perform their activities.
For example, web browsers use HTTP or HTTPS – to do web surfing. Email
programs, such as Microsoft Outlook, use post office protocol (POP) or the Simple Mail
Transfer Protocol (SMTP) for transferring emails.
So, the application layer provides means
to access information on the network.
This is a list of protocols
provided by the application layer
DNS - Domain Name System translates IP
addresses into Domain Names and vice-versa.
DHCP - Dynamic Host Configuration Protocol
automatically assign IP addresses to computers present in the network.
FTP - File Transfer Protocol is used to transfer files on the Internet
HTTP - HyperText Transfer Protocol is used for sending and receiving webpages
IMAP - Internet Message Access Protocol is used for email messages on the Internet
IRC - Internet Relay Chat protocol is used for Internet chat.
POP3 - Post Office Protocol Version 3 is used by email clients to
retrieve messages from remote servers
SMTP - Simple Mail Transfer Protocol is
used for email messages on the Internet
It completes the TCP/IP protocol suite.
If you have learnt something from this video, then please like this video. Share this video so that
more people can learn. Thanks for watching.