TCP Ip
TCP Ip
TCP/IP
● TCP/IP is a network model designed to support network communication, even if
the computers are from different manufacturers.
● 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,
What is communication
● 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
● 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.
4 layers TCP/IP
● Application layer
● Network layer
● Physical layer
Physical layer
● The physical layer is the place where actual communication takes place
● Converts this binary sequence into signals and transmits them over local
media.
● 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.
● Signal generated by the Physical Layer depends on the type of media used to
connect two devices.
Physical layer
● Ethernet is the most common protocol use in physical layer
● The protocol also specifies the type of cables that can be used for data
transmission
Physical layer protocol Cable to be used
• Ethernet • Twisted Pair cable
• Coaxial cable
• Fiber optic cable
• Fast Ethernet • Twisted Pair Cable
• Gigabit Ethernet • Fiber Optic Cable
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:
1. Medium-access control or MAC sublayer, and
2. Logical link control or LLC sub-layer
Medium-access control or MAC sublayer
● 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.
Accessing media
For accessing the media, the access method Ethernet uses is called Carrier
Sense Multiple Access/Collision Detection or CSMA/CD.
Carrier sense multiple access/Collision Detection
(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.
Logical link layer
● 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
Error control in the data link layer primarily refers to error detection and
retransmission.
Error control detection
● 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).
Network layer
● The transport layer passes TCP segments or UDP datagrams to the
Network Layer.
● The network layer also determines the best path for data delivery.
Network layer
So the functions of the network layer are:
● Logical Addressing
● Routing
● Path determination
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.
● 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.
● It is one network, so the ARP module works here.
● 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.
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.
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.
UDP
○ Data transfer
○ Connection termination
Connection Establishment phase
● 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.
● Ordered-data transfer
● Congestion throttling
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.
Application layer
● List of protocol
○ DNS
○ DHCP
○ FTP
○ HTTP
○ SMTP
DNS
Domain Name System translates IP addresses into Domain Names and vice-
versa.
FTP
File Transfer Protocol is used to transfer files on the Internet
HTTP
HyperText Transfer Protocol is used for sending and receiving webpages
SMTP
Simple Mail Transfer Protocol is used for email messages on the Internet