0% found this document useful (0 votes)
22 views24 pages

Unit 4 Networking (GZRSC)

Uploaded by

24w0591
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views24 pages

Unit 4 Networking (GZRSC)

Uploaded by

24w0591
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Networking I Unit 4 (GZRSC) 2021

What is IPv4?
IP stands for Internet Protocol and v4 stands for Version Four (IPv4). IPv4 was the primary
version brought into action for production within the ARPANET in 1983. An Internet Protocol
address is a unique identifier for devices connected to a network. The unique identifier makes it
possible for devices to find and communicate with each other.
IP version four addresses are 32-bit
32 bit integers which will be expressed in hexadecimal
packet
notation. IPv4 is a connectionless protocol for use on packet-switched networks.
The address space of IPv4 is 232 or 4,294,967,296

Example- 192.0.2.126 could be an IPv4 address.


address
Ipv4 uses a 32-bit 8 bits separated with a dot (period).
bit addressing system with four fields of 8-bits
The number of fields in a 32-bit allows for 4.29 billion individual IP addresses.
bit based system allows

Characteristics of IPv4
1) IPv4 could be a 32-BitBit IP Address.
2) IPv4 could be a numeric address, and its bits are separated by a dot.
3) The number of header fields are twelve and the length of the header filed is twent
twenty.
4) It has Unicast, broadcast, and multicast style of addresses.
5) IPv4 supports VLSM (Virtual Length Subnet Mask).
6) IPv4 uses the Post Address Resolution Protocol to map to mack address.
7) RIP may be a routing protocol supported by the routed daemon.
8) Networks oughtught to be designed either manually or with DHCP.
9) Packet fragmentation permits from routers and causing host.

Types Of IP Address-
IP Addresses may be of the following two types-
types

1. Static IP Address-
Static IP Address is an IP Address that
once assigned to a network element
always remains the same.
They are configured manually.

2. Dynamic IP Address-

Dynamic IP Address is a temporarily assigned IP Address to a network element.


It can be assigned to a different device if it is not in use.
DHCP or PPPoE
PPoE assigns dynamic IP addresses.
Networking I Unit 4 (GZRSC) 2021

IP Address Format-
IP Address is a 32 bit binary address
written as 4 numbers separated by dots.
The 4 numbers are called as octets where
each octet has 8 bits.
The octets are divided into 2 components-
components
Net ID and Host ID.

1. Network ID represents the IP Address of the network and is used to identify the network.
2. Host ID represents the IP Address of the host and is used to identify the host within the network
Example of an IP Address is-
IP Address Format-

Site Dot-decimal Binary

Google.com 172.217.168.238 10101100.11011001.10101000.11101110

Facebook.com 31.13.84.36 00011111.00001101.01010100.00100100

Pinterest.com 151.101.0.84 10010111.01100101.00000000.01010100

IP Addressing-
There are two systems in which classified
hich IP Addresses are classified-

Classful Addressing-

classes-
In Classful Addressing System, IP Addresses are organized into following 5 classes
Networking I Unit 4 (GZRSC) 2021

1. Class A
If the 32 bit binary address starts with a bit 0, then IP Address belongs to class A.

Network ID (8bits) Host ID (24bits)


Total number
umber of networks available in class A :No
: of subnet= 27 = 126
Total number of hosts that can be configured in class A : No. of hosts=224

Octet
00000000.00000000.00000000.00000000
.00000000.00000000.00000000 Or 0.0.0.0 Or 0 - 127
To to
01111111. .00000000.00000000.0000000
.00000000.00000000.00000000 127.0.0.0
64 32 16 8 4 2 1=127
Class A is used by organizations requiring very large size networks like NASA, Pentagon etc.

2. Class B (Range 128-191)

1 0 Network Id ( 14 bits) Host Id (16 bits)

No of subnet= 214
No. of hosts=216

128
10000000.00000000.00000000.00000000
.00000000.00000000.00000000 Or 0.0.0.0 Or 128 - 191
Octet To to
10111111. .00000000.00000000.00000000 127.0.0.0
128 0 32 16 8 4 2 1=191

Class B is used by organizations requiring medium size networks like IRCTC, banks etc.

3. Class C (Range 224-239)

1 1 0 Network Id (21 bits) Host Id (8bits)

No of subnet= 221
Networking I Unit 4 (GZRSC) 2021
No. of hosts=28

128 64 =192
11000000.00000000.00000000.00000000 Or 0.0.0.0 Or 192 - 223
To to
11011111. .00000000.00000000.00000000 127.0.0.0
128 64 0 16 8 4 2 1=223

Class C is used by organizations requiring small to medium size networks.


For example- engineering colleges, small universities, small offices etc.

4. Class D

1 1 1 0 Multicast Address

128 64 32 =224
11100000.00000000.00000000.00000000 Or 0.0.0.0 Or 224 - 239
To to
11101111. .00000000.00000000.00000000 127.0.0.0
128 64 32 0 8 4 2 1=239

Class D is reserved for multicasting.


In multicasting, there is no need to extract host address from the IP Address.
This is because data is not destined for a particular host.

5. Class E

1 1 1 1 Reserve for future use

128 64 32 16 =240
11110000.00000000.00000000.00000000 Or 0.0.0.0 Or 240 - 293
To to
11111111. .00000000.00000000.00000000 127.0.0.0
128 64 32 16 8 4 2 1=255

Class E is reserved for future or experimental purposes.

Classes of IP Address-

All the classes of IP Address are summarized in the following table-

Page 4
Networking I Unit 4 (GZRSC) 2021

Total 1st Number


Class of Hosts
Number of Octet of Default
IP per
IP Decimal Networks Subnet Mask
Address network
Addresses Range available

Class A 231 1 – 126 27 – 2 224 – 2 255.0.0.0

128 –
Class B 230 214 216 – 2 255.255.0.0
191

192 –
Class C 229 221 28 – 2 255.255.255.0
223

224 – Not Not


Class D 228 Not defined
239 defined defined

240 – Not Not


Class E 228 Not defined
254 defined defined

Page 5
Networking I Unit 4 (GZRSC) 2021

IPv4 Header-
The following diagram represents the IPv4 header

1. Version-Version is a 4 bit field that indicates the IP version used.


2. Header Length-Header length is a 4 bit field that contains the length of the IP header.
3. Type Of Service-Type of service is a 8 bit field that is used for Quality of Service (QoS).
4. Total Length-Total length is a 16 bit field that contains the total length of the datagram (in bytes).
5. Identification-It is used for the identification of the fragments of an original IP datagram.
6. DF Bit-DF bit stands for Do Not Fragment bit.Its value may be 0 or 1.
7. MF Bit-MF bit stands for More Fragments bit.Its value may be 0 or 1.
8. Fragment Offset-It indicates the position of a fragmented datagram in the original unfragmented
IP datagra
9. Time To Live-It indicates the maximum number of hops a datagram can take to reach the
destination.
10. Protocol-It tells the network layer at the destination host to which protocol the IP datagram
belongs to. Protocol number of ICMP is 1, IGMP is 2, TCP is 6 and UDP is 17.
11. Header Checksum-The checksum value is used for error checking of the header.
12. Source IP Address-It contains the logical address of the sender of the datagram.
13. Destination IP Address-It contains the logical address of the receiver of the datagram.
14. Options-This field is used for several purposes such as-
a) Record route
b) Source routing
c) Padding

Page 6
Networking I Unit 4 (GZRSC) 2021

IPv6
IPv6 is the latest version of the Internet Protocol, which identifies devices across the internet
so they can be located. Every device that uses the internet is identified through its own IP address in
order for internet communication to work.
The previous version, IPv4, uses a 32-bit
32 bit addressing scheme to support 4.3 billion devices,
which was thought to be enough. However, the growth of the internet, personal computers,
smartphones and now Internet of Things devices proves that the world needed more addresses.
Fortunately, the Internet Engineering Task Force (IETF) recognized this 20 years ago. In
128 bit addressing to support approximately 340 trillion
1998 it created IPv6, which instead uses 128-bit
like). Instead of the IPv4 address method of four sets of one
trillion (or 2 to the 128th power, if you like). one-
to three-digit
digit numbers, IPv6 uses eight groups of four hexadecimal digits, separated by colons.
Networking I Unit 4 (GZRSC) 2021

IPv6 has three types of addresses:

1.Unicast Addresses :The packet sent to a unicast address must be delivered to the specific computer.
2. Multicast Addresses : The packet sent to a multicast address must be delivered to the each member
of the group.
3. Anycast Addresses : The packet sent to a anycast address is delivered to only one of the member
of the group, the nearest one.
Note : Broadcast is not defined in IPv6.

Key benefits to IPv6 include:

1) No more NAT (Network Address Translation)


2) Auto-configuration
3) No more private address collisions
4) Better multicast routing
5) Simpler header format
6) Simplified, more efficient routing
7) True quality of service (QoS), also called "flow labeling"
8) Built-in authentication and privacy support
9) Flexible options and extensions
10) Easier administration (no more DHCP)

Comparison IPv4 and IPv6

Page 8
Networking I Unit 4 (GZRSC) 2021

Network address translation


What Is NAT?
NAT stands for network address translation. It’s a way to map multiple local private addresses to a
public one before transferring the information. Organizations that want multiple devices to employ a
single IP address use NAT, as do most home routers.
How Does NAT Work?
Let’s say that there is a laptop connected to a home router. Someone uses the laptop to search
for directions to their favorite restaurant. The laptop sends this request in a packet to the router,
which passes it along to the web. But first, the router changes the outgoing IP address from a private
local address to a public address.
If the packet keeps a private address, the receiving server won’t know where to send the
information back to — this is akin to sending physical mail and requesting return service but
providing a return address of anonymous. By using NAT, the information will make it back to the
laptop using the router’s public address, not the laptop’s private one.

NAT Types
There are three different types of NATs. People use them for different reasons, but they all still work
as a NAT.

1. Static NAT
When the local address is converted to a public one, this NAT chooses the same one. This means
there will be a consistent public IP address associated with that router or NAT device.

2. Dynamic NAT
Instead of choosing the same IP address every time, this NAT goes through a pool of public IP
addresses. This results in the router or NAT device getting a different address each time the router
translates the local address to a public address.

3. PAT
PAT stands for port address translation. It’s a type of dynamic NAT, but it bands several local IP
addresses to a singular public one. Organizations that want all their employees’ activity to use a
singular IP address use a PAT, often under the supervision of a network administrator.

ICMP Protocol

Page 9
Networking I Unit 4 (GZRSC) 2021
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

ICMP function : (1) Error reporting


(2) Network diagnostic : Traceroute-routing path
Ping
1.Error reporting
The primary purpose of ICMP is for error reporting. When two devices connect over the
Internet, the ICMP generates errors to share with the sending device in the event that any of the
data did not get to its intended destination. For example, if a packet of data is too large for a
router, the router will drop the packet and send an ICMP message back to the original source for
the data.
2. Network diagnostic
A secondary use of ICMP protocol is to perform network diagnostics; the commonly
used terminal utilities traceroute and ping both operate using ICMP.
The traceroute utility is used to display the routing path between two Internet devices.
The routing path is the actual physical path of connected routers that a request must pass
through before it reaches its destination. The journey between one router and another is known
as a ‘hop,’ and a traceroute also reports the time required for each hop along the way. This can
be useful for determining sources of network delay.
The ping utility is a simplified version of traceroute. A ping will test the speed of the
connection between two devices and report exactly how long it takes a packet of data to reach
its destination and come back to the sender’s device. Although ping does not provide data about
routing or hops, it is still a very useful metric for gauging the latency between two devices. The
ICMP echo-request and echo-reply messages are commonly used for the purpose of performing
a ping. Ping -test the speed of connection between two devices

ICMP messages are organized in types and codes. Types and codes are numeric values.

Page 10
Networking I Unit 4 (GZRSC) 2021
Type: It is an 8-bit field. It defines the ICMP message type. The values range from 0 to 127 are
defined for ICMPv6, and the values from 128 to 255 are the informational messages.
Code: It is an 8-bit field that defines the subtype of the ICMP message
Checksum: It is a 16-bit field to detect whether the error exists in the message or not.
It sets the value checksum field to 0 and performs the same checksum operation. After running
the checksum operation, it compares the result with the value stored in the checksum field. If
both values are the same, the message is considered valid. All valid messages are processed
while are invalid messages are discarded.
Message body
Every IP packet consists of two fields: header and data. IP protocol includes all necessary
information in every IP packet making it capable to reach its destination by taking whatever
path is available. This information is included in the header field of IP packets. The first 64 bits
of the data field contain the header of the upper layer. It contains the source and destination port
number field used by the TCP layer.
ICMP uses this information to inform the sender which IP packet failed. The message body
field of an ICMP error message contains two fields: the original message header and the
original message data. These fields are used to include the header and the first 64 bits of the
data field of the failed message. When a source receives an ICMP error message, by examining
the message body field it can determine which IP packet was failed.

ICMP Error messages


ICMP error messages are used to report non-transient delivery problems. ICMP provides two
sets of error messages: one for IPv4 and another for IPv6. The following table lists all ICMP
error messages.

ICMP message type Description Codes IP Version


3 Destination Unreachable 0 - 15 IPv4
5 Redirect 0-3 IPv4
11 Time Exceeded 0-1 IPv4
12 Parameter Problem 0 -2 IPv4
4 Source Quench (Deprecated) NA IPv4
1 Destination Unreachable 0-8 IPv6
2 Packet Too Big 0 IPv6
3 Time Exceeded 0-1 IPv6
4 Parameter Problem 0 - 10 IPv6

Routing is a process which is performed by layer 3 (or network layer) devices in order to deliver
the packet by choosing an optimal path from one network to another.
What is routing?
Network routing is the process of selecting a path across one or more networks. The principles
of routing can apply to any type of network, from telephone networks to public transportation.
In packet-switching networks, such as the Internet, routing selects the paths for Internet
Protocol (IP) packets to travel from their origin to their destination. These Internet routing
decisions are made by specialized pieces of network hardware called routers.

Page 11
Networking I Unit 4 (GZRSC) 2021
What is routing?
Routing is a procedure of maintaining a routing table at each router, to send packets/
information/data to the desired destination. It uses algorithms that calculate the most optimal path in
terms of effective distance, cost, bandwidth, and reliability, etc. (also known as Routing algorithm
metrics). At each router, a table is maintained that contains information about its neighbors,
destination, distance, and next hop. When a packet arrives at a router, the destination is checked, and
depending on it, the packet is sent forward. All tables are shared frequently among routers to keep a
track of path information. On the Internet, routing is used.
Network routing is the process of selecting a path across one or more networks. Routing is a
process which is performed by layer 3 (or network layer) devices in order to deliver the packet by
choosing an optimal path from one network to another
Routing algorithm
1. Adaptive algorithm (Dynamic routing)
a) Distance-vector routing
b) Link state routing
2. Non-Adaptive algorithm (Static routing)
a) Flooding

Distance Vector Routing Algorithm-


A distance-vector routing (DVR) protocol requires that a router inform its neighbors of
topology changes periodically. Historically known as the old ARPANET routing algorithm (or
known as Bellman-Ford algorithm).
Bellman Ford Basics – Each router maintains a Distance Vector table containing the distance
between itself and ALL possible destination nodes. Distances, based on a chosen metric, are
computed using information from the neighbors’ distance vectors.

Distance Vector Algorithm –


1) A router transmits its distance vector to each of its neighbors in a routing packet.
2) Each router receives and saves the most recently received distance vector from each of its
neighbors.
3) A router recalculates its distance vector when:
a) It receives a distance vector from a neighbor containing different information than
before.
b) It discovers that a link to a neighbor has gone down.
The DV calculation is based on minimizing the cost to each destination

Dx(y) = Estimate of least cost from x to y


C(x,v) = Node x knows cost to each neighbor v
Dx = [Dx(y): y ∈ N ] = Node x maintains distance vector

Node x also maintains its neighbors' distance vectors


– For each neighbor v, x maintains Dv = [Dv(y): y ∈ N ]
From time-to-time, each node sends its own distance vector estimate to neighbors.

Page 12
Networking I Unit 4 (GZRSC) 2021
When a node x receives new DV estimate from any neighbor v, it saves v’s distance vector and it
updates its own DV using B-F equation:
Dx(y) = min { C(x,v) + Dv(y), Dx(y) } for each node y ∈ N

9
B E Destination Cost Next hop
1 A 1 A
A
3 2
C 3 C

5 D 7 C
C D
4 E 9 E
Source Destination

B as a source

B to A : B-A=1
B-C-A=3+5=8
B-E-D-C-A=9+2+4+5=20

B to C : B-C=3
B-A-C=6
B-E-D-C=9+2+4=15

B to D : B-A-C-D=1+5+4=10
B-C-D=3+4=7
B-E-D=9+2=11

B to E : B-E=9
B-C-D-E=3+4+2=9
B-A-C-D-E=1+5+4+2=12

Link State Routing –


Link state routing is a technique in which each router shares the knowledge of its
neighborhood with every other router in the internetwork.
Link state routing is the second family of routing protocols. While distance vector routers use
a distributed algorithm to compute their routing tables, link-state routing uses link-state routers to
exchange messages that allow each router to learn the entire network topology. Based on this learned
topology, each router is then able to compute its routing table by using a shortest path computation.

Features of link state routing protocols –

Link state packet – A small packet that contains routing information.

Page 13
Networking I Unit 4 (GZRSC) 2021
Link state database – A collection information gathered from link state packet.
Shortest path first algorithm (Dijkstra algorithm) – A calculation performed on the database results
into shortest path
Routing table – A list of known paths and interfaces.

Calculation of shortest path –


To find shortest path, each node need to run the famous Dijkstra algorithm. This famous algorithm
uses the following steps:

2
C 1
A
3 5 2
D F

1 3 2
B
4 E

Iteration Tree B C D E F
Initial A 3 2 5 ∞ ∞
1 A,C 3 - 4 ∞ 3
2 A,B,C - - 4 7 3
3 A,B,C,F - - 4 5 -
4 A,B,C,D,F - - - 5 -
5 A,B,C,D,E,F - - - - -

Unicast – Unicast means the transmission from a single sender to a single receiver. It is a point to
point communication between sender and receiver. There are various unicast protocols such as TCP,
HTTP, etc.

TCP is the most commonly used unicast protocol. It is a connection oriented protocol that
relay on acknowledgement from the receiver side.
HTTP stands for Hyper Text Transfer Protocol. It is an object oriented protocol for communication.
There are three major protocols for unicast routing:

Distance Vector Routing


Link State Routing
Path-Vector Routing

What is flooding in routing?

Page 14
Networking I Unit 4 (GZRSC) 2021
Flooding is used in computer networks routing algorithm in which every incoming packet is
sent through every outgoing link except the one it arrived on. Flooding, which is similar to
broadcasting, occurs when source packets (without routing data) are transmitted to all attached
network nodes. Because flooding uses. When a packet is received, the routers send it to all the
interfaces except the one on which it was received. This creates too much burden on the network and
lots of duplicate packets wandering in the network

Flooding is used in bridging and in systems such as Usenet and peer-to-peer file sharing and
as part of some routing protocols, including OSPF, DVMRP, and those used in ad-hoc wireless
networks (WANETs)

B C D

A Data : Packet
Z
Source
E F Destination

Types
1.Uncontrolled Flooding: In uncontrolled flooding each node unconditionally distributes
packets to each of its neighbors. Without conditional logic to prevent indefinite recirculation of the
same packet, broadcast storms are a hazard.
2.Controlled flooding: Controlled flooding has its own two algorithms to make it reliable,
SNCF (Sequence Number Controlled Flooding) and RPF (Reverse Path Forwarding). In SNCF, the
node attaches its own address and sequence number to the packet, since every node has a memory of
addresses and sequence numbers. If it receives a packet in memory, it drops it immediately while in
RPF, the node will only send the packet forward. If it is received from the next node, it sends it back
to the sender.

Advantages
The advantages of this method are that it is very simple to implement, if a packet can be
delivered then it will (probably multiple times), and since flooding naturally utilizes every path
through the network it will also use the shortest path.
Disadvantages
Flooding can be costly in terms of wasted bandwidth. While a message may only have one
destination it has to be sent to every host. In the case of a ping flood or a denial of service attack, it
can be harmful to the reliability of a computer network.
Messages can become duplicated in the network further increasing the load on the network as
well as requiring an increase in processing complexity to disregard duplicate messages. Duplicate
packets may circulate forever, unless certain precautions are taken:

Page 15
Networking I Unit 4 (GZRSC) 2021

Transport Layer Protocols-


Protocols
laye protocols that are used on the Internet-
There are mainly two transport layer

Transmission Control Protocol (TCP)


Transmission Control Protocol (TCP) – a connection-oriented
oriented communications protocol that
facilitates the exchange of messages between computing devices in a network. It is a transport layer
protocol that facilitates the transmission of packets from source to destination. It is the most common
protocol in networks that use the Internet Protocol (IP); together they are sometimes referred to as
TCP/IP.
It contains four layers, unlike seven layers in the OSI model. The layers are:
1) Process/Application Layer
2) Host-to-Host/Transport
Host/Transport Layer
3) Internet Layer
4) Network Access/Link Layer
Networking I Unit 4 (GZRSC) 2021
Characteristics Of TCP
1. TCP is a reliable protocol.
It guarantees the delivery of data packets to its correct destination.
2. TCP is a connection oriented protocol.
TCP establishes an end to end connection between the source and destination.
The connection is established before exchanging the data.
3. TCP handles both congestion and flow control.
TCP handles congestion and flow control by controlling the window size.
4. TCP ensures in-order delivery.
Sequence Numbers are used to coordinate which data has been transmitted and received.
5. TCP connections are full duplex.
TCP connection allows to send data in both the directions at the same time.
6. TCP works in collaboration with Internet Protocol.
Combination of port numbers and IP Addresses of sender and receiver.
7. TCP can use both selective & cumulative acknowledgements.
TCP uses a combination of Selective Repeat and Go back N protocols.
8. TCP is a byte stream protocol.
9.TCP provides error checking & recovery mechanism.
TCP provides error checking and recovery using three simple techniques-
1) Checksum
2) Acknowledgement
3) Retransmission

TCP Segment structure –


TCP segment consists of data bytes to be sent and a header that is added to the data by

The header of a TCP segment can range from 20-60 bytes. 40 bytes are for options. If there
are no options, header is of 20 bytes else it can be of upmost 60 bytes.

Page 17
Networking I Unit 4 (GZRSC) 2021
Header fields:
Source Port Address –
16 bit field that holds the port address of the application that is sending the data segment.
Destination Port Address –
16 bit field that holds the port address of the application in the host that is receiving the data
segment.
Sequence Number –
32 bit field that holds the sequence number, i.e, the byte number of the first byte that is sent
in that particular segment. It is used to reassemble the message at the receiving end if the segments
are received out of order.
Acknowledgement Number –
32 bit field that holds the acknowledgement number, i.e, the byte number that the receiver
expects to receive next. It is an acknowledgment for the previous bytes being received successfully.
Header Length (HLEN) –
This is a 4 bit field that indicates the length of the TCP header by number of 4-byte words in
the header, i.e, if the header is of 20 bytes(min length of TCP header), then this field will hold 5
(because 5 x 4 = 20) and the maximum length: 60 bytes, then it’ll hold the value 15(because 15 x 4 =
60). Hence, the value of this field is always between 5 and 15.
Control flags –
These are 6 1-bit control bits that control connection establishment, connection termination,
connection abortion, flow control, mode of transfer etc. Their function is:
1) URG: Urgent pointer is valid
2) ACK: Acknowledgement number is valid( used in case of cumulative
acknowledgement)
3) PSH: Request for push
4) RST: Reset the connection
5) SYN: Synchronize sequence numbers
6) FIN: Terminate the connection
Window size –
This field tells the window size of the sending TCP in bytes.
Checksum –
This field holds the checksum for error control. It is mandatory in TCP as opposed to UDP.
Urgent pointer –
This field (valid only if the URG control flag is set) is used to point to data that is urgently
required that needs to reach the receiving process at the earliest. The value of this field is added to
the sequence number to get the byte number of the last urgent byte.
TCP Connection –
TCP is connection oriented. A TCP connection is established by 3-way handshake.

Services and Segment structure in TCP

The Transmission Control Protocol is the most common transport layer protocol. It works
together with IP and provides a reliable transport service between processes using the network layer
service provided by the IP protocol.
The various services provided by the TCP to the application layer are as follows:
1. Process-to-Process Communication –
TCP provides process to process communication, i.e, the transfer of data takes place between
individual processes executing on end systems. This is done using port numbers or port addresses.
Port numbers are 16 bit long that help identify which process is sending or receiving data on a host.

Page 18
Networking I Unit 4 (GZRSC) 2021
2. Stream oriented –
This means that the data is sent and received as a stream of bytes(unlike UDP or IP that
divides the bits into datagrams or packets). However, the network layer, that provides service for the
TCP, sends packets of information not streams of bytes. Hence, TCP groups a number of bytes
together into a segment and adds a header to each of these segments and then delivers these segments
to the network layer. At the network layer, each of these segments are encapsulated in an IP packet
for transmission. The TCP header has information that is required
required for control purpose which will be
discussed along with the segment structure.
3. Full duplex service –
This means that the communication can take place in both directions at the same time.
4. Connection oriented service –
connection oriented service. It defines 3 different phases:
Unlike UDP, TCP provides connection
Connection establishment
Data transfer
Connection termination
(IMP: This is a virtual connection, not a physical connection, means during the transmission
segments will not follow the same path to reach the
the resources will not be reserved and the segments
destination but it is a connection orientation in the sense that segments will arrive in order by the
help of sequence number.)
5. Reliability –
attempts to recover lost or corrupted
TCP is reliable as it uses checksum for error detection, attempts
packets by re-transmission,
transmission, acknowledgement policy and timers. It uses features like byte number
and sequence number and acknowledgement number so as to ensure reliability. Also, it uses
congestion control mechanisms.
6. Multiplexing –
de multiplexing at the sender and receiver ends respectively as a
TCP does multiplexing and de-multiplexing
number of logical connections can be established between port numbers over a physical connection.
Byte number, Sequence number and Acknowledgement number: numbe
All the data bytes that are to be transmitted are numbered and the beginning of this
numbering is arbitrary. Sequence numbers are given to the segments so as to reassemble the bytes at
the receiver end even if they arrive in a different order. Sequence number of a segment is the byte
number of the first byte that is being sent. Acknowledgement number is required since TCP provides
full duplex service. Acknowledgement number is
the next byte number that the receiver expects to
receive which also provides acknowledgement for
receiving the previous bytes.
Example:

In this example we see that, A sends


acknowledgement number1001, which means that
it has received data bytes till byte number 1000
and expects to receive 1001 next, hence B next
sends data bytes starting from 1001. Similarly,
since B has received data bytes till byte number
13001 after the first data transfer from A to B,
therefore B sends acknowledgement number
13002, the byte number that it expects to receive
from A next.
Networking I Unit 4 (GZRSC) 2021
FIN Bit-
FIN bit is used
sed to terminate the TCP connection
When FIN bit is set to 1,
1) It indicates the receiver that the sender wants to terminate the connection.
2) FIN segment sent for TCP Connection Termination contains FIN bit set to 1.

User Datagram Protocol (UDP)


User Datagram m Protocol (UDP) is a Transport Layer protocol. UDP is a part of Internet
Protocol suite, referred as UDP/IP suite. Unlike TCP, it is unreliable and connectionless protocol. So,
there is no need to establish connection prior to data transfer.
The User Datagram
agram Protocol (UDP) is simplest Transport Layer communication protocol
available of the TCP/IP protocol suite. It involves minimum amount of communication mechanism.
UDP is said to be an unreliable transport protocol but it uses IP services which provides best effort
delivery mechanism.
In UDP, the receiver does not generate an acknowledgement of packet received and in turn,
the sender does not wait for any acknowledgement of packet sent. This shortcoming makes this
protocol unreliable as well as easier on processing.
Features
UDP is used when acknowledgement of data does not hold any significance.
UDP is good protocol for data flowing in one direction.
UDP is simple and suitable for query based communications.
UDP is not connection oriented.
UDP does not provide
rovide congestion control mechanism.
UDP does not guarantee ordered delivery of data.
UDP is stateless.
UDP is suitable protocol for streaming applications such as VoIP, multimedia streaming.
UDP Header
UDP header is as simple as its function.

UDP header er contains four main parameters:


1.Source Port - This 16 bits information is used to identify the source port of the packet.
2.Destination Port - This 16 bits information, is used identify application level service on
destination machine.
3.Length - Length 16-bits
ngth field specifies the entire length of UDP packet (including header). It is 16
field and minimum value is 8-byte,
byte, i.e. the size of UDP header itself.
Networking I Unit 4 (GZRSC) 2021
4. Checksum - This field stores the checksum value generated by the sender before sending. IPv4
has this field as optional so when checksum field does not contain any value it is made 0 and all its
bits are set to zero.

Applications of UDP:

1. Used for simple request response communication when size of data is less and hence there
is lesser concern about flow and error control.
2. It is suitable protocol for multicasting as UDP supports packet switching.
3. UDP is used for some routing update protocols like RIP(Routing Information Protocol).
4. Normally used for real time applications which can not tolerate uneven delays between
sections of a received message.
5. Following implementations uses UDP as a transport layer protocol:
a) NTP (Network Time Protocol)
b) DNS (Domain Name Service)
c) BOOTP, DHCP.
d) NNP (Network News Protocol)
e) Quote of the day protocol
f) TFTP, RTSP, RIP.
6. Application layer can do some of the tasks through UDP-
a) Trace Route
b) Record Route
c) Time stamp
7. UDP takes datagram from Network Layer, attach its header and send it to the user. So, it
works fast.
8. Actually UDP is null protocol if you remove checksum field.
a) Reduce the requirement of computer resources.
b) When using the Multicast or Broadcast to transfer.
c) The transmission of Real-time packets, mainly in multimedia applications.

Page 21
Networking I Unit 4 (GZRSC) 2021

Differences between TCP and UDP


Transmission control protocol (TCP) User datagram protocol (UDP)
TCP is a connection-oriented protocol. UDP is the Datagram oriented protocol. This is
Connection-orientation means that the because there is no overhead for opening a
communicating devices should establish a connection, maintaining a connection, and
connection before transmitting data and should terminating a connection. UDP is efficient for
close the connection after transmitting the data. broadcast and multicast type of network
transmission.
TCP is reliable as it guarantees the delivery of The delivery of data to the destination cannot be
data to the destination router. guaranteed in UDP.
TCP provides extensive error checking UDP has only the basic error checking
mechanisms. It is because it provides flow mechanism using checksums.
control and acknowledgment of data.
Sequencing of data is a feature of Transmission There is no sequencing of data in UDP. If the
Control Protocol (TCP). this means that packets order is required, it has to be managed by the
arrive in-order at the receiver. application layer.
TCP is comparatively slower than UDP. UDP is faster, simpler, and more efficient than
TCP.
Retransmission of lost packets is possible in There is no retransmission of lost packets in the
TCP, but not in UDP. User Datagram Protocol (UDP).
TCP has a (20-60) bytes variable length header. UDP has an 8 bytes fixed-length header.
TCP is heavy-weight. UDP is lightweight.
TCP doesn’t support Broadcasting. UDP supports Broadcasting.
TCP is used by HTTP, HTTPs, FTP, SMTP and UDP is used by DNS, DHCP, TFTP, SNMP, RIP,
Telnet. and VoIP.

MCQ

1.The pseudo header of IP is used in-


a) Only TCP
b) Only UDP
c) Both TCP and UDP
d) None
Solution-
IP Pseudo header is used in both TCP and UDP while calculating checksum.
Thus, Option (C) is correct.

2.Broadcasting applications like WHOD (who daemon on UNIX) uses what transport layer protocol?
a) TCP
b) UDP
c) Either TCP or UDP
d) IGMP

Solution-
Broadcasting and multicasting applications use UDP.

Page 22
Networking I Unit 4 (GZRSC) 2021
Thus, Option (B) is correct.

3.The transport layer protocols used for real time multimedia, file transfer, DNS and email,
respectively are:
(A) TCP, UDP, UDP and TCP
(B) UDP, TCP, TCP and UDP
(C) UDP, TCP, UDP and TCP
(D) TCP, UDP, TCP and UDP

Answer: (C)

Explanation: TCP (Transmission Control Protocol) and UDP(User Datagram Protocol) are two
main transport layer protocols.
TCP is connection oriented and UDP is connectionless, this makes TCP more reliable than UDP.
But UDP is stateless (less overhead), that makes UDP is suitable for purposes where error
checking and correction is less important than timely delivery.
For real time multimedia, timely delivery is more important than correctness. –> UDP
For file transfer, correctness is necessary. –> TCP
DNS, timely delivery is more important –> UDP
Email again same as file transfer –> TCP

4. Which of the following transport layer protocols is used to support electronic mail?
(A) SMTP
(B) IP
(C) TCP
(D) UDP

Answer: (C)
Explanation: E-mail uses SMTP as application layer protocol.
TCP and UDP are two transport layer protocols. SMTP uses TCP as transport layer protocol as TCP
is reliable.

5.Which one of the following uses UDP as the transport protocol?


(A) HTTP
(B) Telnet
(C) DNS
(D) SMTP

Answer: (C)
Explanation:
UDP is a stateless ,connectionless and unreliable protocol.
HTTP needs connection to be established and thus,uses TCP.
Telnet is a byte stream protocol which again needs connection establishment ,thus uses TCP.
DNS needs request and response ,it needs a protocol in which a server can answer the small
queries of large number of users. As UDP is fast and stateless it is the most suitable protocol and
thus,it is used in DNS querying .
SMTP needs reliability and thus,uses TCP.

Page 23
Networking I Unit 4 (GZRSC) 2021
//………….//
DNS uses UDP.
HTTP, Telnet and SMTP uses TCP.
Thus, C is the correct choice.

6. Packets of the same session may be routed through different paths in


(A) TCP, but not UDP
(B) TCP and UDP
(C) UDP, but not TCP
(D) Neither TCP, nor UDP

Answer: (B)

7. Which of the following statements are TRUE?


(S1) TCP handles both congestion and flow control
(S2) UDP handles congestion but not flow control
(S3) Fast retransmit deals with congestion but not flow control
(S4) Slow start mechanism deals with both congestion and flow control
(A) S1, S2 and S3 only
(B) S1 and S3 only
(C) S3 and S4 only
(D) S1, S3 and S4 only

Answer: (B)
Explanation: 1: with the help of TCP window=>flow control and with the help of congestion
window=> Congestion control
2: No field are there in UDP header to control flow or congestion
3: It is used by TCP to overcome the problem of out of order segments by re-transmission
4: Slow start, nothing to do with flow control

Page 24

You might also like