computer network
computer network
Working Principle
A bridge loop is created when there are more than one paths between two nodes in
a given network. When a message is sent, particularly when a broadcast is done, the
bridges repeatedly rebroadcast the same message flooding the network. Since a
data link layer frame does not have a time-to-live field in the header, the broadcast
frame may loop forever, thus swamping the channels.
Spanning tree protocol creates a spanning tree by disabling all links that form a loop
or cycle in the network. This leaves exactly one active path between any two nodes
of the network. So when a message is broadcast, there is no way that the same
message can be received from an alternate path. The bridges that participate in
spanning tree protocol are often called spanning tree bridges.
To construct a spanning tree, the bridges broadcast their configuration routes. Then
they execute a distributed algorithm for finding out the minimal spanning tree in the
network, i.e. the spanning tree with minimal cost. The links not included in this tree
are disabled but not removed.
In case a particular active link fails, the algorithm is executed again to find the
minimal spanning tree without the failed link. The communication continues through
the newly formed spanning tree. When a failed link is restored, the algorithm is re-
run including the newly restored link.
Example
Let us consider a physical topology, as shown in the diagram, for an Ethernet
network that comprises of six interconnected bridges. The bridges are named {B1,
B2, B3, B4, B5, B6} and several nodes are connected to each bridge. The links
between two bridges are named {L1, L2, L3, L4, L5, L6, L7, L8, L9}, where L1
connects B1 and B2, L2 connects B1 and B3 and so on. It is assumed that all links
are of uniform costs.
From the diagram we can see that there are multiple paths from a bridge to any
other bridge in the network, forming several bridge loops that makes the topology
susceptible to broadcast storms.
According to spanning tree protocol, links that form a cycle are disabled. Thus,we
get a logical topology so that there is exactly one route between any two bridges.
One possible logical topology is shown in the following diagram below containing
links {L1, L2, L3, L4, L5} −
In the above logical configuration, if a situation arises such that link L4 fails. Then,
the spanning tree is reconstituted leaving L4. A possible logical reconfiguration
containing links {L1, L2, L3, L5, L9} is as follows −
Analog Multiplexing
The analog multiplexing techniques involve signals which are analog in nature. The
analog signals are multiplexed according to their frequency (FDM) or wavelength
(WDM).
Frequency Division Multiplexing (FDM)
In analog multiplexing, the most used technique is Frequency Division Multiplexing
FDM. This technique uses various frequencies to combine streams of data, for
sending them on a communication medium, as a single signal.
Example: A traditional television transmitter, which sends a number of channels
through a single cable, uses FDM.
Wavelength Division Multiplexing (WDM)
Wavelength Division Multiplexing is an analog technique, in which many data
streams of different wavelengths are transmitted in the light spectrum. If the
wavelength increases, the frequency of the signal decreases.
Example: Optical fibre Communications use the WDM technique, to merge different
wavelengths into a single light for the communication.
Digital Multiplexing
The term digital represents the discrete bits of information. Hence the available data
is in the form of frames or packets, which are discrete.
Time Division Multiplexing (TDM)
In TDM, the time frame is divided into slots. This technique is used to transmit a
signal over a single communication channel, with allotting one slot for each
message. Of all the types of TDM, the main ones are Synchronous and
Asynchronous TDM.
Synchronous TDM
In Synchronous TDM, the input is connected to a frame. If there are ‘n’ number of
connections, then the frame is divided into ‘n’ time slots. One slot is allocated for
each input line. In this technique, the sampling rate is common to all signals and
hence same clock input is given. The mux allocates the same slot to each device at
all times.
Asynchronous TDM
In Asynchronous TDM, the sampling rate is different for each of the signals and the
clock signal is also not in common. If the allotted device, for a time-slot, transmits
nothing and sits idle, then that slot is allotted to another device, unlike synchronous.
Network Layer
o The Network Layer is the third layer of the OSI model.
o It handles the service requests from the transport layer and further forwards the
service request to the data link layer.
o The network layer translates the logical addresses into physical addresses
o It determines the route from the source to the destination and also manages the
traffic problems such as switching, routing and controls the congestion of data
packets.
o The main role of the network layer is to move the packets from sending host to the
receiving host.
For example, the router with a header field value of 0111 arrives at a router, and then
router indexes this header value into the forwarding table that determines the output
link interface is 2. The router forwards the packet to the interface 2. The routing
algorithm determines the values that are inserted in the forwarding table. The routing
algorithm can be centralized or decentralized.
Store-and-forward
Connection-Oriented Service
A connection-oriented service is a network service that was designed and developed
after the telephone system. A connection-oriented service is used to create an end to
end connection between the sender and the receiver before transmitting the data
over the same or different networks. In connection-oriented service, packets are
transmitted to the receiver in the same order the sender has sent them. It uses a
handshake method that creates a connection between the user and sender for
transmitting the data over the network. Hence it is also known as a reliable network
service.
Suppose, a sender wants to send data to the receiver. Then, first, the sender sends a
request packet to a receiver in the form of an SYN packet. After that, the receiver
responds to the sender's request with an (SYN-ACK) signal/packets. That represents
the confirmation is received by the receiver to start the communication between the
sender and the receiver. Now a sender can send the message or data to the receiver.
Similarly, a receiver can respond or send the data to the sender in the form of
packets. After successfully exchanging or transmitting data, a sender can terminate
the connection by sending a signal to the receiver. In this way, we can say that it is a
reliable network service.
S. Comparison Connection-oriented Service Connection Less Service
No Parameter
1. Related It is designed and developed based on the It is service based on the postal system.
System telephone system.
2. Definition It is used to create an end to end It is used to transfer the data packets
connection between the senders to the
between senders to the receiver without creating
receiver before transmitting the data over
the same or different network. any connection.
3. Virtual path It creates a virtual path between the It does not create any virtual connection or
sender and the receiver.
path between the sender and the receiver.
5. Data Packets All data packets are received in the same Not all data packets are received in the same
Path order as those sent by the sender.
order as those sent by the sender.
6. Bandwidth It requires a higher bandwidth to transfer It requires low bandwidth to transfer the data packets.
Requirement the data packets.
7. Data It is a more reliable connection service It is not a reliable connection service because
Reliability because it guarantees data packets
it does not guarantee the transfer of data
transfer from one end to the other end
with a connection. packets from one end to another for establishing
a connection.
8. Congestion There is no congestion as it provides an There may be congestion due to not providing an en
end-to-end connection between sender end connection between the source and receive
and receiver during transmission of data. transmit of data packets.
The delay between data units in circuit The delay between data units in
switching is uniform. packet switching is not uniform.
Packet switching is
The circuit switching network is
implemented at the datalink
implemented at the physical layer.
layer and network layer
STEP 1: The set sptSet is initially empty and distances assigned to vertices
are {0, INF, INF, INF, INF, INF, INF, INF} where INF indicates infinite. Now pick
the vertex with a minimum distance value. The vertex 0 is picked and
included in sptSet. So sptSet becomes {0}. After including 0 to sptSet, update
the distance values of its adjacent vertices. Adjacent vertices of 0 are 1 and
7. The distance values of 1 and 7 are updated as 4 and 8.
The following subgraph shows vertices and their distance values. Vertices
included in SPT are included in GREEN color.
Hop Count
Hop count is the number of routers occurring in between the source and
destination network. The path with the lowest hop count is considered as the
best route to reach a network and therefore placed in the routing table. RIP
prevents routing loops by limiting the number of hops allowed in a path from
source and destination. The maximum hop count allowed for RIP is 15 and a
hop count of 16 is considered as network unreachable.
RIP v1 is known as Classful Routing Protocol because it doesn’t send
information of subnet mask in its routing update.
RIP v2 is known as Classless Routing Protocol because it sends information
of subnet mask in its routing update.
Consider the above-given topology which has 3-routers R1, R2, R3. R1 has IP
address 172.16.10.6/30 on s0/0/1, 192.168.20.1/24 on fa0/0. R2 has IP
address 172.16.10.2/30 on s0/0/0, 192.168.10.1/24 on fa0/0. R3 has IP
address 172.16.10.5/30 on s0/1, 172.16.10.1/30 on s0/0, 10.10.10.1/24 on
fa0/0.
Configure RIP for R1 :
R1(config)# router rip
R1(config-router)# network 192.168.20.0
R1(config-router)# network 172.16.10.4
R1(config-router)# version 2
R1(config-router)# no auto-summary
Note: no auto-summary command disables the auto-summarisation. If we
don’t select any auto-summary, then the subnet mask will be considered as
classful in Version 1.
Configuring RIP for R2:
R2(config)# router rip
R2(config-router)# network 192.168.10.0
R2(config-router)# network 172.16.10.0
R2(config-router)# version 2
R2(config-router)# no auto-summary
Similarly, Configure RIP for R3 :
R3(config)# router rip
R3(config-router)# network 10.10.10.0
R3(config-router)# network 172.16.10.4
R3(config-router)# network 172.16.10.0
R3(config-router)# version 2
R3(config-router)# no auto-summary
Advantages –
As it maintains separate tables for both the best route and the backup
routes ( whole topology) therefore it has more knowledge of the
internetwork than any other distance vector routing protocol.
Concept of triggered updates is used therefore no more unnecessary
bandwidth consumption is seen like in distance vector routing
protocol.
Partial updates are triggered when there is a topology change, not a
full update like distance vector routing protocol where the whole
routing table is exchanged.
User can view the logical User can never view physical
Visibility
address of a program. address of program.
Parameter LOGICAL ADDRESS PHYSICAL ADDRESS
IP address:-
An IP address is the identifier that enables your device to send or receive data
packets across the internet. It holds information related to your location and
therefore making devices available for two-way communication. The internet
requires a process to distinguish between different networks, routers, and websites.
Therefore, IP addresses provide the mechanism of doing so, and it forms an
indispensable part in the working of the internet. You will notice that most of the IP
addresses are essentially numerical. Still, as the world is witnessing a colossal
growth of network users, the network developers had to add letters and some
addresses as internet usage grows.
Internet Protocol or IP runs the same manner as other languages, i.e., applying the
set guidelines to communicate the information. All devices obtain, send, and pass
information with other associated devices with the help of this protocol only. By
using the same language, the computers placed anywhere can communicate with
one another.
Types of IP addresses
There are various classifications of IP addresses, and each category further contains
some types.
Consumer IP addresses
Every individual or firm with an active internet service system pursues two types of
IP addresses, i.e., Private IP (Internet Protocol) addresses and public IP (Internet
Protocol) addresses. The public and private correlate to the network area. Therefore,
a private IP address is practiced inside a network, whereas the other (public IP
address) is practiced outside a network.
1. Private IP addresses
All the devices that are linked with your internet network are allocated a private IP
address. It holds computers, desktops, laptops, smartphones, tablets, or even Wi-Fi-
enabled gadgets such as speakers, printers, or smart Televisions. With the
expansion of IoT (internet of things), the demand for private IP addresses at
individual homes is also seemingly growing. However, the router requires a method
to identify these things distinctly. Therefore, your router produces unique private IP
addresses that act as an identifier for every device using your internet network. Thus,
differentiating them from one another on the network.
2. Public IP addresses
Public IP addresses are further classified into two categories- dynamic and static.
o Dynamic IP addresses
As the name suggests, Dynamic IP addresses change automatically and frequently.
With this types of IP address, ISPs already purchase a bulk stock of IP addresses and
allocate them in some order to their customers. Periodically, they re-allocate the IP
addresses and place the used ones back into the IP addresses pool so they can be
used later for another client. The foundation for this method is to make cost savings
profits for the ISP.
o Static IP addresses
In comparison to dynamic IP addresses, static addresses are constant in nature. The
network assigns the IP address to the device only once and, it remains consistent.
Though most firms or individuals do not prefer to have a static IP address, it is
essential to have a static IP address for an organization that wants to host its
network server. It protects websites and email addresses linked with it with a
constant IP address.
1. Shared IP addresses
Many startups or individual website makers or various SME websites who don't want
to invest initially in dedicated IP addresses can opt for shared hosting plans. Various
web hosting providers are there in the market providing shared hosting services
where two or more websites are hosted on the same server. Shared hosting is only
feasible for websites that receive average traffic, the volumes are manageable, and
the websites themselves are confined in terms of the webpages, etc.
2. Dedicated IP addresses
Web hosting providers also provide the option to acquire a dedicated IP address.
Undoubtedly dedicated IP addresses are more secure, and they permit the users to
run their File Transfer Protocol (FTP) server. Therefore, it is easier to share and
transfer data with many people within a business, and it also provides the option of
anonymous FTP sharing. Another advantage of a dedicated IP addresses it the user
can easily access the website using the IP address rather than typing the full domain
name.
CIDR addresses are represented using a slash notation, which specifies the number
of bits in the network prefix. For example, an IP address of 192.168.1.0 with a prefix
length of 24 would be represented as 192.168.1.0/24. This notation indicates that
the first 24 bits of the IP address are the network prefix and the remaining 8 bits are
the host identifier.
Advantages:
1. Efficient use of IP addresses: CIDR allows for more efficient use of IP
addresses, which is important as the pool of available IPv4 addresses
continues to shrink.
2. Flexibility: CIDR allows for more flexible allocation of IP addresses, which can
be important for organizations with complex network requirements.
3. Better routing: CIDR allows for more efficient routing of IP traffic, which can
lead to better network performance.
Reduced administrative overhead: CIDR reduces administrative overhead by
allowing for easier management of IP addresses and routing.
Disadvantages:
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.
IP version four addresses are 32-bit integers which will be expressed in decimal
notation.
Example- 192.0.2.126 could be an IPv4 address.
Parts of IPv4
Network part:
The network part indicates the distinctive variety that’s appointed to the
network. The network part conjointly identifies the category of the network
that’s assigned.
Host Part:
The host part uniquely identifies the machine on your network. This part of the
IPv4 address is assigned to every host.
For each host on the network, the network part is the same, however, the host
half must vary.
Subnet number:
This is the nonobligatory part of IPv4. Local networks that have massive
numbers of hosts are divided into subnets and subnet numbers are appointed
to that.
Characteristics of IPv4
Advantages of IPv4
Limitations of IPv4
Internet Protocol version 6 (IPV 6) is the replacement for version 4 (IPV 4). The
phenomenal development of the Internet has begun to push IP to its limits. It
provides a large address space, and it contains a simple header as compared to
IPv4.
Features of IPV6
There are various features of IPV6, which are as follows−
Larger address space: An IPV6 address is 128 bits long. It is compared with the 32-
bit address of IPV4. It will allow for unique IP-addresses up to 3.4 x 1038 whereas IPV4
allows up to 4.3 x 108 unique address.
Better Header format: New header form has been designed to reduce overhead. It is
done by moving both non-essential fields and optional fields to extension field header
that are placed after the IPV6 header.
More Functionality: It is designed with more options like priority of packet for control
of congestion, Authentication etc.
Allowance for Extension: It is designed to allow the extension of the protocol if
required by new technologies.
Support of resource allocation: In IPV6, the type of service fields has been removed,
but a new mechanism has been added to support traffic control or flow labels like
real-time audio and video.
IPV6 Packet Format
It is a compulsory base header followed by the payload. The payload includes two
parts (1) optional extension headers and data called payload from the upper layer.
The base header occupies 40 bytes, and extension headers and data from the upper
layer usually contain up to 65, 535 bytes of data.
Base Header has 8 fields which are as follows−
Version: It is a four-bit field that defines the version number of the IP. IP6 version is 6,
IP4 version is 4.
Priority: It is a 4-bit priority field that defines the priority of the packet with respect to
traffic congestion that a packet is to reject or not.
Flow Label: It is three bytes or 24-bit field designed to provide special handling for a
particular flow of data to speed flow on an already flowing packet path.
Payload Length: It is a two-byte payload length field that defines the total length of
the IP datagram, excluding the base header.
Next Header: It is an 8-bit field that defines the header that follows the base header in
the datagram. In IPV4, this field is called a protocol. Some of the values in this field
indicate options that are
Code Next Header
2 ICMP
6 TCP
17 UDP
43 Source Routing
44 Fragmentation
50 Authentication
59 Null
60 Destination Option
Source Address: This field is 16-byte which specifies the original source of the
datagram destination address. This is a 16-byte internet address that usually
identifies the final destination of the datagram.
Priority: IPV6 divides traffic into two broad categories, which are as follows:
Congestion Control Traffic: If a source adopts itself to traffic showdown when there
is congestion. In TCP protocol, congestion-control data is assigned priority 0 to 7,
such as 0 for lowest and 7 for highest in congestion.
Priority Meaning
1 Background data
Priority Meaning
3 Reserved
5 Reserved
6 Interactive Traffic
7 Control Traffic
Address mapping
The physical address is unique to the local network but not in the universal
network such as the Internet. However, the logical address is unique
universally. Now why do we require both addresses, we can use only one
type of address to identify a host or router in the network.
The physical address and the logical address both are different identifiers
and we require both of them as the physical address defines the physical
connection between source host to destination host whereas the logical
address defines routable connection from source host to the destination
host and from network to network.
There are two kinds of address mapping, static address mapping, and dynamic
address mapping. In the section ahead we will discuss both of them in detail.
1. Static Mapping
A source host knows the logical address of the host to which it wants to deliver
the packet so it can refer to the routing table to recognize the physical address of
the destined host. But the static address mapping has some constraint over the
physical address of the device as it changes in certain conditions such as:
1. If a device changes its Network Interface Card (NIC), the physical address of
the device also changes. As the physical address is hardcoded on the NIC
card at the time of its manufacturing.
2. Some local networks such as LocalTalk compel the connected device to
change its physical address each time the device turns on.
3. Nowadays there are some third-party apps through which users can change
their physical address.
Even the logical address of the device also changes under some circumstances
such as:
1. If the host switches the network, this changes the logical address of the host.
2. If you reset your modem, it also results in a change of logical address.
3. If the host gets connected to the network via VPN (Virtual Private Network)
then it appears that you
In such a scenario, if we use static address mapping, more time will be wasted in
updating the routing table at each connected device and this will generate
overhead on the connected devices which will also affect the performance of the
network. A solution to this is dynamic mapping.
2. Dynamic Mapping
In dynamic mapping usually, the source host knows the logical address of the
destination host but to deliver the packet to the destined host its physical
address is required as at the physical level the device is identified by its physical
address.
So, the source host uses the protocols to identify the physical address of the
destination host. Two protocols are designed for dynamic mapping ARP
(Address Resolution Protocol) and RARP (Reverse Address Resolution Protocol).
Internet Control Message Protocol (ICMP)
Uses of ICMP
ICMP is used for error reporting if two devices connect over the internet and
some error occurs, So, the router sends an ICMP error message to the source
informing about the error. For Example, whenever a device sends any message
which is large enough for the receiver, in that case, the receiver will drop the
message and reply back ICMP message to the source.
Traceroute: Traceroute utility is used to know the route between two devices
connected over the internet. It routes the journey from one router to another, and
a traceroute is performed to check network issues before data transfer.
ICMP is the primary and important protocol of the IP suite, but ICMP isn’t
associated with any transport layer protocol (TCP or UDP) as it doesn’t need to
establish a connection with the destination device before sending any message
as it is a connectionless protocol.
ICMP packets are transmitted in the form of datagrams that contain an IP header
with ICMP data. ICMP datagram is similar to a packet, which is an independent
data entity.
In the ICMP packet format, the first 32 bits of the packet contain three fields:
Type (8-bit): The initial 8-bit of the packet is for message type, it provides a brief
description of the message so that receiving network would know what kind of
message it is receiving and how to respond to it. Some common message types
are as follows:
Code (8-bit): Code is the next 8 bits of the ICMP packet format, this field carries
some additional information about the error message and type.
Checksum (16-bit): Last 16 bits are for the checksum field in the ICMP packet
header. The checksum is used to check the number of bits of the complete
message and enable the ICMP tool to ensure that complete data is delivered.
The next 32 bits of the ICMP Header are Extended Header which has the work of
pointing out the problem in IP Message. Byte locations are identified by the
pointer which causes the problem message and receiving device looks here for
pointing to the problem.
The last part of the ICMP packet is Data or Payload of variable length. The bytes
included in IPv4 are 576 bytes and in IPv6, 1280 bytes.
Whenever an attacker sends a ping, whose size is greater than the maximum
allowable size, oversized packets are broken into smaller parts. When the sender
re-assembles it, the size exceeds the limit which causes a buffer overflow and
makes the machine freeze. This is simply called a Ping of Death Attack. Newer
devices have protection from this attack, but older devices did not have
protection from this attack.
Whenever the sender sends so many pings that the device on whom the target is
done is unable to handle the echo request. This type of attack is called an ICMP
Flood Attack. This attack is also called a ping flood attack. It stops the target
computer’s resources and causes a denial of service for the target computer.
ARP
If the host wants to know the physical address of another host on its network,
then it sends an ARP query packet that includes the IP address and broadcast it
over the network. Every host on the network receives and processes the ARP
packet, but only the intended recipient recognizes the IP address and sends back
the physical address. The host holding the datagram adds the physical address
to the cache memory and to the datagram header, then sends back to the sender.
Steps taken by ARP protocol
If a device wants to communicate with another device, the following steps are
taken by the device:
o The device will first look at its internet list, called the ARP cache to check
whether an IP address contains a matching MAC address or not. It will check
the ARP cache in command prompt by using a command arp-a.
o If ARP cache is empty, then device broadcast the message to the entire
network asking each device for a matching MAC address.
o The device that has the matching IP address will then respond back to the
sender with its MAC address
o Once the MAC address is received by the device, then the communication can
take place between two devices.
o If the device receives the MAC address, then the MAC address gets stored in
the ARP cache. We can check the ARP cache in command prompt by using a
command arp -a.
There are two types of ARP entries:
RARP
ICMP
o ICMP stands for Internet Control Message Protocol.
o The ICMP is a network layer protocol used by hosts and routers to send the
notifications of IP datagram problems back to the sender.
o ICMP uses echo test/reply to check whether the destination is reachable and
responding.
o ICMP handles both control and error messages, but its main function is to
report the error but not to correct them.
o An IP datagram contains the addresses of both source and destination, but it
does not know the address of the previous router through which it has been
passed. Due to this reason, ICMP can only send the messages to the source,
but not to the immediate routers.
o ICMP protocol communicates the error messages to the sender. ICMP
messages cause the errors to be returned back to the user processes.
o ICMP messages are transmitted within IP datagram.
Error Reporting
o Destination unreachable
o Source Quench
o Time Exceeded
o Parameter problems
o Redirection
There are two ways when Time Exceeded message can be generated:
Sometimes packet discarded due to some bad routing implementation, and this
causes the looping issue and network congestion. Due to the looping issue, the
value of TTL keeps on decrementing, and when it reaches zero, the router
discards the datagram. However, when the datagram is discarded by the router,
the time exceeded message will be sent by the router to the source host.
When destination host does not receive all the fragments in a certain time limit,
then the received fragments are also discarded, and the destination host sends
time Exceeded message to the source host.
IGMP
Where,
Type: It determines the type of IGMP message. There are three types of IGMP
message: Membership Query, Membership Report and Leave Report.
Maximum Response Time: This field is used only by the Membership Query
message. It determines the maximum time the host can send the Membership
Report message in response to the Membership Query message.
Group Address: The behavior of this field depends on the type of the message
sent.
o For Membership Query, the group address is set to zero for General Query
and set to multicast group address for a specific query.
o For Membership Report, the group address is set to the multicast group
address.
o For Leave Group, it is set to the multicast group address.
IGMP Messages
o Membership Query message
o This message is sent by a router to all hosts on a local area network to
determine the set of all the multicast groups that have been joined by
the host.
o It also determines whether a specific multicast group has been joined
by the hosts on a attached interface.
o The group address in the query is zero since the router expects one
response from a host for every group that contains one or more
members on that host.
o Membership Report message
o The host responds to the membership query message with a
membership report message.
o Membership report messages can also be generated by the host when
a host wants to join the multicast group without waiting for a
membership query message from the router.
o Membership report messages are received by a router as well as all the
hosts on an attached interface.
o Each membership report message includes the multicast address of a
single group that the host wants to join.
o IGMP protocol does not care which host has joined the group or how
many hosts are present in a single group. It only cares whether one or
more attached hosts belong to a single multicast group.
o The membership Query message sent by a router also includes a
"Maximum Response time". After receiving a membership query
message and before sending the membership report message, the
host waits for the random amount of time from 0 to the maximum
response time. If a host observes that some other attached host has
sent the "Maximum Report message", then it discards its "Maximum
Report message" as it knows that the attached router already knows
that one or more hosts have joined a single multicast group. This
process is known as feedback suppression. It provides the
performance optimization, thus avoiding the unnecessary transmission
of a "Membership Report message".
Components of DHCP
DHCP Server: DHCP Server is basically a server that holds IP Addresses and
other information related to configuration.
DHCP Client: It is basically a device that receives configuration information
from the server. It can be a mobile, laptop, computer, or any other electronic
device that requires a connection.
DHCP Relay: DHCP relays basically work as a communication channel
between DHCP Client and Server.
IP Address Pool: It is the pool or container of IP Addresses possessed by the
DHCP Server. It has a range of addresses that can be allocated to devices.
Subnets: Subnets are smaller portions of the IP network partitioned to keep
networks under control.
Lease: It is simply the time that how long the information received from the
server is valid, in case of expiration of the lease, the tenant must have to re-
assign the lease.
DNS Servers: DHCP servers can also provide DNS (Domain Name System)
server information to DHCP clients, allowing them to resolve domain names
to IP addresses.
Default Gateway: DHCP servers can also provide information about the
default gateway, which is the device that packets are sent to when the
destination is outside the local network.
Options: DHCP servers can provide additional configuration options to clients,
such as the subnet mask, domain name, and time server information.
Renewal: DHCP clients can request to renew their lease before it expires to
ensure that they continue to have a valid IP address and configuration
information.
Failover: DHCP servers can be configured for failover, where two servers work
together to provide redundancy and ensure that clients can always obtain an
IP address and configuration information, even if one server goes down.
Dynamic Updates: DHCP servers can also be configured to dynamically
update DNS records with the IP address of DHCP clients, allowing for easier
management of network resources.
Audit Logging: DHCP servers can keep audit logs of all DHCP transactions,
providing administrators with visibility into which devices are using which IP
addresses and when leases are being assigned or renewed.
Working of DHCP
The DHCP port number for the server is 67 and for the client is 68. It is a client-
server protocol that uses UDP services. An IP address is assigned from a pool of
addresses. In DHCP, the client and the server exchange mainly 4 DHCP messages in
order to make a connection, also called the DORA process, but there are 8 DHCP
messages in the process.
UDP
Where,
o Source port address: It defines the address of the application process that
has delivered a message. The source port address is of 16 bits address.
o Destination port address: It defines the address of the application process
that will receive the message. The destination port address is of a 16-bit
address.
o Total length: It defines the total length of the user datagram in bytes. It is a 16
-bit field.
o Checksum: The checksum is a 16-bit field which is used in error detection.
TCP
o URG: The URG field indicates that the data in a segment is urgent.
o ACK: When ACK field is set, then it validates the acknowledgement number.
o PSH: The PSH field is used to inform the sender that higher throughput is
needed so if possible, data must be pushed with higher throughput.
o RST: The reset bit is used to reset the TCP connection when there is any
confusion occurs in the sequence numbers.
o SYN: The SYN field is used to synchronize the sequence numbers in three
types of segments: connection request, connection confirmation ( with the
ACK bit set ), and confirmation acknowledgement.
o FIN: The FIN field is used to inform the receiving TCP module that the sender
has finished sending data. It is used in connection termination in three types
of segments: termination request, termination confirmation, and
acknowledgement of termination confirmation.
o Window Size: The window is a 16-bit field that defines the size of the
window.
o Checksum: The checksum is a 16-bit field used in error detection.
o Urgent pointer: If URG flag is set to 1, then this 16-bit field is an offset
from the sequence number indicating that it is a last urgent data byte.
o Options and padding: It defines the optional fields that convey the
additional information to the receiver.
Definition TCP establishes a virtual circuit UDP transmits the data directly to the
before transmitting the data. destination computer without verifying
whether the receiver is ready to receive or
not.
acknowledgement It waits for the acknowledgement It neither takes the acknowledgement, nor
of data and has the ability to it retransmits the damaged frame.
resend the lost packets.
1. Process-to-Process Communication –
TCP provides a process to process communication, i.e, the transfer of data
that takes place between individual processes executing on end systems.
This is done using port numbers or port addresses. Port numbers are 16 bits
long that help identify which process is sending or receiving data on a host.
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 is encapsulated in an IP packet for transmission. The TCP header
has information that is required for control purposes 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 –
Unlike UDP, TCP provides a connection-oriented service. It defines 3 different
phases:
Connection establishment
Data transfer
Connection termination
5. Reliability –
TCP is reliable as it uses checksum for error detection, attempts to recover
lost or corrupted packets by re-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 –
TCP does multiplexing and de-multiplexing at the sender and receiver ends
respectively as a number of logical connections can be established between
port numbers over a physical connection.
The header of a TCP segment can range from 20-60 bytes. 40 bytes are for
options. If there are no options, a header is 20 bytes else it can be of upmost
60 bytes.
Header fields:
Sequence Number –
A 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 of the segments that are received out of
order.
Acknowledgement Number –
A 32-bit field that holds the acknowledgement number, i.e, the byte
number that the receiver expects to receive next. It is an
acknowledgement for the previous bytes being received successfully.
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:
URG: Urgent pointer is valid
ACK: Acknowledgement number is valid( used in case of
cumulative acknowledgement)
PSH: Request for push
RST: Reset the connection
SYN: Synchronize sequence numbers
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.
Prerequisite to use the Sliding window technique
The use of the Sliding Window technique can be done in a very specific
scenario, where the size of the window for computation is fixed throughout
the complete nested loop. Only then the time complexity can be reduced.
How to use Sliding Window Technique?
The general use of the Sliding window technique can be demonstrated as
follows:
1. Find the size of the window required
2. Compute the result for 1st window, i.e. from the start of the data structure
3. Then use a loop to slide the window by 1, and keep computing the result
window by window.
TCP congestion control is a method used by the TCP protocol to manage data
flow over a network and prevent congestion. TCP uses a congestion window and
congestion policy that avoids congestion. Previously, we assumed that only the
receiver could dictate the sender’s window size. We ignored another entity here,
the network. If the network cannot deliver the data as fast as it is created by the
sender, it must tell the sender to slow down. In other words, in addition to the
receiver, the network is a second entity that determines the size of the sender’s
window
Exponential increment: In this phase after every RTT the congestion window size
increments exponentially.
Example:- If the initial congestion window size is 1 segment, and the first
segment is successfully acknowledged, the congestion window size becomes 2
segments. If the next transmission is also acknowledged, the congestion window
size doubles to 4 segments. This exponential growth continues as long as all
segments are successfully acknowledged.
Initially cwnd = 1
Additive increment: This phase starts after the threshold value also denoted as
ssthresh. The size of cwnd(congestion window) increases additive. After each
RTT cwnd = cwnd + 1.
Example:- if the congestion window size is 20 segments and all 20 segments are
successfully acknowledged within an RTT, the congestion window size would be
increased to 21 segments in the next RTT. If all 21 segments are again
successfully acknowledged, the congestion window size would be increased to
22 segments, and so on.
Initially cwnd = i
What is congestion?
A state occurring in network layer when the message traffic is so heavy that it
slows down network response time.
Effects of Congestion
The leaky bucket algorithm discovers its use in the context of network traffic
shaping or rate-limiting.
A leaky bucket execution and a token bucket execution are predominantly
used for traffic shaping algorithms.
This algorithm is used to control the rate at which traffic is sent to the
network and shape the burst traffic to a steady traffic stream.
The disadvantages compared with the leaky-bucket algorithm are the
inefficient use of available network resources.
The large area of network resources such as bandwidth is not being used
effectively.
1. When host wants to send packet, packet is thrown into the bucket.
2. The bucket leaks at a constant rate, meaning the network interface transmits
packets at a constant rate.
3. Bursty traffic is converted to a uniform traffic by the leaky bucket.
4. In practice the bucket is a finite queue that outputs at a finite rate.
The leaky bucket algorithm has a rigid output design at an average rate
independent of the bursty traffic.
In some applications, when large bursts arrive, the output is allowed to speed
up. This calls for a more flexible algorithm, preferably one that never loses
information. Therefore, a token bucket algorithm finds its uses in network
traffic shaping or rate-limiting.
It is a control algorithm that indicates when traffic should be sent. This order
comes based on the display of tokens in the bucket.
The bucket contains tokens. Each of the tokens defines a packet of
predetermined size. Tokens in the bucket are deleted for the ability to share a
packet.
When tokens are shown, a flow to transmit traffic appears in the display of
tokens.
No token means no flow sends its packets. Hence, a flow transfers traffic up
to its peak burst rate in good tokens in the bucket.
The leaky bucket algorithm enforces output pattern at the average rate, no matter
how bursty the traffic is. So in order to deal with the bursty traffic we need a
flexible algorithm so that the data is not lost. One such algorithm is token bucket
algorithm.
Let’s understand with an example, In figure (A) we see a bucket holding three
tokens, with five packets waiting to be transmitted. For a packet to be
transmitted, it must capture and destroy one token. In figure (B) We see that
three of the five packets have gotten through, but the other two are stuck waiting
for more tokens to be generated.
Ways in which token bucket is superior to leaky bucket: The leaky bucket
algorithm controls the rate at which the packets are introduced in the network,
but it is very conservative in nature. Some flexibility is introduced in the token
bucket algorithm. In the token bucket, algorithm tokens are generated at each
tick (up to a certain limit). For an incoming packet to be transmitted, it must
capture a token and the transmission takes place at the same rate. Hence some
of the busty packets are transmitted at the same rate if tokens are available and
thus introduces some amount of flexibility in the system.
Application Layer
The Application Layer, as discussed above, being topmost layer in OSI model,
performs several kinds of functions which are requirement in any kind of
application or communication process.
Following are list of functions which are performed by Application Layer of OSI
Model –
Data from User <=> Application layer <=> Data from Presentation Layer
Application Layer provides a facility by which users can forward several
emails and it also provides a storage facility.
This layer allows users to access, retrieve and manage files in a remote
computer.
It allows users to log on as a remote host.
This layer provides access to global information about various services.
This layer provides services which include: e-mail, transferring files,
distributing results to the user, directory services, network resources and so
on.
It provides protocols that allow software to send and receive information and
present meaningful data to users.
It handles issues such as network transparency, resource allocation and so on.
This layer serves as a window for users and application processes to access
network services.
Application Layer is basically not a function, but it performs application layer
functions.
The application layer is actually an abstraction layer that specifies the shared
protocols and interface methods used by hosts in a communication network.
Application Layer helps us to identify communication partners, and
synchronizing communication.
This layer allows users to interact with other software applications.
In this layer, data is in visual form, which makes users truly understand data
rather than remembering or visualize the data in the binary format (0’s or 1’s).
This application layer basically interacts with Operating System (OS) and thus
further preserves the data in a suitable manner.
This layer also receives and preserves data from it’s previous layer, which is
Presentation Layer (which carries in itself the syntax and semantics of the
information transmitted).
The protocols which are used in this application layer depend upon what
information users wish to send or receive.
This application layer, in general, performs host initialization followed by
remote login to hosts.
o In Client-server architecture, clients do not directly communicate with each other. For
example, in a web application, two browsers do not directly communicate with each
other.
o A server is fixed, well-known address known as IP address because the server is
always on while the client can always contact the server by sending a packet to the
sender's IP address.