Computer Networks
Computer Networks
An Autonomous Institution
(Approved by AICTE, New Delhi, Affiliated to Anna University, Chennai, Accredited with “A” Grade by NAAC)
Coimbatore – 641 032
DNS
DNS, E-Mail -SMTP, MIME, POP3, IMAP, FTP, HTTP, WWW, symmetric and asymmetric key
cryptography, Sharing of symmetric keys – Diffie-Hellman key Exchange, Public Key Infrastructure,
Public Key Authentication Protocols, Firewalls.
An application layer protocol defines how the application processes running on different systems,
pass the messages to each other.
DNS is a TCP/IP protocol used on different platforms. The domain name space is divided into three
different sections: generic domains, country domains, and inverse domain.
Generic Domains
Label Description
Country Domain
The format of country domain is same as a generic domain, but it uses two-character country
abbreviations (e.g., us for the United States) in place of three character organizational abbreviations.
Inverse Domain
The inverse domain is used for mapping an address to a name. When the server has received a
request from the client, and the server contains the files of only authorized clients. To determine
whether the client is on the authorized list or not, it sends a query to the DNS server and ask for
mapping an address to the name.
Working of DNS
o DNS is a client/server network communication protocol. DNS clients send requests to the.
server while DNS servers send responses to the client.
o Client requests contain a name which is converted into an IP address known as a forward
DNS lookups while requests containing an IP address which is converted into a name known
as reverse DNS lookups.
o DNS implements a distributed database to store the name of all the hosts available on the
internet.
o If a client like a web browser sends a request containing a hostname, then a piece of software
such as DNS resolver sends a request to the DNS server to obtain the IP address of a
hostname. If DNS server does not contain the IP address associated with a hostname, then it
forwards the request to another DNS server. If IP address has arrived at the resolver, which in
turn completes the request over the internet protocol.
DNS is a hostname for IP address translation service. DNS is a distributed database implemented in
a hierarchy of name servers. It is an application layer protocol for message exchange between clients
and servers.
Requirement: Every host is identified by the IP address but remembering numbers is very difficult for
the people also the IP addresses are not static therefore a mapping is required to change the domain
name to the IP address. So DNS is used to convert the domain name of the websites to their
numerical IP address.
Domain: There are various kinds of DOMAIN:
1. Generic domain: .com(commercial) .edu(educational) .mil(military) .org(non profit organization)
.net(similar to commercial) all these are generic domain.
2. Country domain .in (india) .us .uk
3. Inverse domain if we want to know what is the domain name of the website. Ip to domain name
mapping. So DNS can provide both the mapping for example to find the ip addresses of
geeksforgeeks.org then we have to type nslookup www.geeksforgeeks.org.
Organization of Domain:
It is very difficult to find out the ip address associated to a website because there are millions of
websites and with all those websites we should be able to generate the ip address immediately, there
should not be a lot of delay for that to happen organization of database is very important.
DNS record: Domain name, ip address what is the validity?? what is the time to live ?? and all the
information related to that domain name. These records are stored in tree like structure.
Namespace: Set of possible names, flat or hierarchical. The naming system maintains a collection of
bindings of names to values – given a name, a resolution mechanism returns the corresponding
value.
Name server: It is an implementation of the resolution mechanism. DNS (Domain Name System) =
Name service in Internet – Zone is an administrative unit, domain is a subtree.
Name to Address Resolution:
The host requests the DNS name server to resolve the domain name. And the name server returns
the IP address corresponding to that domain name to the host so that the host can future connect to
that IP address.
Hierarchy of Name Servers Root name servers: It is contacted by name servers that can not
resolve the name. It contacts authoritative name server if name mapping is not known. It then gets the
mapping and returns the IP address to the host.
Top level domain (TLD) server: It is responsible for com, org, edu etc and all top level country
domains like uk, fr, ca, in etc. They have info about authoritative domain servers and know the names
and IP addresses of each authoritative name server for the second-level domains.
Authoritative name servers are the organization’s DNS server, providing authoritative hostName to
IP mapping for organization servers. It can be maintained by an organization or service provider. In
order to reach cse.dtu.in we have to ask the root DNS server, then it will point out to the top level
domain server and then to authoritative domain name server which actually contains the IP address.
So the authoritative domain server will return the associative ip address.
Domain Name Server
The client machine sends a request to the local name server, which , if root does not find the address
in its database, sends a request to the root name server , which in turn, will route the query to an top-
level domain (TLD) or authoritative name server. The root name server can also contain some
hostName to IP address mappings. The Top-level domain (TLD) server always knows who the
authoritative name server is. So finally the IP address is returned to the local name server which in
turn returns the IP address to the host.
SMTP
o SMTP stands for Simple Mail Transfer Protocol.
o SMTP is a set of communication guidelines that allow software to transmit an electronic mail
over the internet is called Simple Mail Transfer Protocol.
o It is a program used for sending messages to other computer users based on e-mail
addresses.
o It provides a mail exchange between users on the same or different computers, and it also
supports:
o The main purpose of SMTP is used to set up communication rules between servers. The
servers have a way of identifying themselves and announcing what kind of communication
they are trying to perform. They also have a way of handling the errors such as incorrect
email address. For example, if the recipient address is wrong, then receiving server reply with
an error message of some kind.
Components of SMTP
o First, we will break the SMTP client and SMTP server into two components such as user
agent (UA) and mail transfer agent (MTA). The user agent (UA) prepares the message,
creates the envelope and then puts the message in the envelope. The mail transfer agent
(MTA) transfers this mail across the internet.
o SMTP allows a more complex system by adding a relaying system. Instead of just having one
MTA at sending side and one at receiving side, more MTAs can be added, acting either as a
client or server to relay the email.
o The relaying system without TCP/IP protocol can also be used to send the emails to users,
and this is achieved by the use of the mail gateway. The mail gateway is a relay MTA that can
be used to receive an email.
Working of SMTP
2. Submission of Mail: After composing an email, the mail client then submits the completed e-
mail to the SMTP server by using SMTP on TCP port 25.
3. Delivery of Mail: E-mail addresses contain two parts: username of the recipient and domain
name. For example, [email protected], where "vivek" is the username of the recipient and
"gmail.com" is the domain name.
If the domain name of the recipient's email address is different from the sender's domain
name, then MSA will send the mail to the Mail Transfer Agent (MTA). To relay the email, the
MTA will find the target domain. It checks the MX record from Domain Name System to obtain
the target domain. The MX record contains the domain name and IP address of the recipient's
domain. Once the record is located, MTA connects to the exchange server to relay the
message.
4. Receipt and Processing of Mail: Once the incoming message is received, the exchange
server delivers it to the incoming server (Mail Delivery Agent) which stores the e-mail where it
waits for the user to retrieve it.
5. Access and Retrieval of Mail: The stored email in MDA can be retrieved by using MUA (Mail
User Agent). MUA can be accessed by using login and password.
MIME Header
There are five header fields represented in MIME which are as follows −
MIME-version − It denotes the MIME version being used. The current version is 1.1. It is
defined as MIME-version: 1.1.
Content-type − It defines the type and subtype of the data in the body of the message. The
content type and content subtype are divided by a slash. This field defines how the object in
the body is to be executed. The default value is plaintext in US ASCII.
The content-type field is represented as follows −
Context-type: <type/subtype; parameters>
Content-transfer encoding − It defines how the object inside the body has been encoded to
US ASCII to create it acceptable for mail transfer. Thus, it determines the method used to
encode the message into 0s and 1s for transport.
The content transfer encoding field is represented as follows −
Content-transfer-encoding : <type>
Content-Description − This field tells what the message is. It is the form of ASCII recipient
will know whether it is worth decoding and reading the message.
Content-ID − This field identifies the contents. Its format is the same as the format of the
standard Message-Id header.
Multipurpose Internet Mail Extension (MIME) is a standard that was proposed by Bell
Communications in 1991 in order to expand the limited capabilities of email.
MIME is a kind of add-on or a supplementary protocol that allows non-ASCII data to be sent
through SMTP. It allows the users to exchange different kinds of data files on the Internet: audio,
video, images, application programs as well.
Why do we need MIME?
Limitations of Simple Mail Transfer Protocol (SMTP):
1. SMTP has a very simple structure
2. Its simplicity however comes with a price as it only sends messages in NVT 7-bit ASCII format.
3. It cannot be used for languages that do not support 7-bit ASCII format such as French,
German, Russian, Chinese and Japanese, etc. so it cannot be transmitted using SMTP. So, in
order to make SMTP more broad, we use MIME.
4. It cannot be used to send binary files or video or audio data.
Purpose and Functionality of MIME –
Growing demand for Email Messages as people also want to express themselves in terms of
Multimedia. So, MIME another email application is introduced as it is not restricted to textual data.
MIME transforms non-ASCII data at the sender side to NVT 7-bit data and delivers it to the client
SMTP. The message on the receiver side is transferred back to the original data. As well as we can
send video and audio data using MIME as it transfers them also in 7-bit ASCII data.
Features of MIME –
1. It is able to send multiple attachments with a single message.
2. Unlimited message length.
3. Binary attachments (executables, images, audio, or video files) may be divided if needed.
4. MIME provided support for varying content types and multi-part messages.
Working of MIME –
Suppose a user wants to send an email through a user agent and it is in a non-ASCII format so
there is a MIME protocol that converts it into 7-bit NVT ASCII format. The message is transferred
through the e-mail system to the other side in the 7-bit format now MIME protocol again converts it
back into non-ASCII code and now the user agent of the receiver side reads it and then information
is finally read by the receiver. MIME header is basically inserted at the beginning of any e-mail
transfer.
MIME with SMTP and POP –
SMTP transfers the mail being a message transfer agent from the sender’s side to the mailbox of
the receiver side and stores it and MIME header is added to the original header and provides
additional information. while POP being the message access agent organizes the mails from the
mail server to the receiver’s computer. POP allows the user agent to connect with the message
transfer agent.
MIME Header:
It is added to the original e-mail header section to define transformation. There are five headers that
we add to the original header:
1. MIME-Version – Defines the version of the MIME protocol. It must have the parameter Value
1.0, which indicates that message is formatted using MIME.
2. Content-Type – Type of data used in the body of the message. They are of different types like
text data (plain, HTML), audio content, or video content.
3. Content-Type Encoding – It defines the method used for encoding the message. Like 7-bit
encoding, 8-bit encoding, etc.
4. Content Id – It is used for uniquely identifying the message.
5. Content description – It defines whether the body is actually an image, video, or audio.
POP Protocol
The POP protocol stands for Post Office Protocol. As we know that SMTP is used as a message
transfer agent. When the message is sent, then SMPT is used to deliver the message from the client
to the server and then to the recipient server. But the message is sent from the recipient server to the
actual server with the help of the Message Access Agent. The Message Access Agent contains two
types of protocols, i.e., POP3 and IMAP.
Since SMTP is a push protocol so it pushes the message from the client to the server. As we can
observe in the above figure that SMTP pushes the message from the client to the recipient's mail
server. The third stage of email communication requires a pull protocol, and POP is a pull protocol.
When the mail is transmitted from the recipient mail server to the client which means that the client is
pulling the mail from the server.
What is POP3?
The POP3 is a simple protocol and having very limited functionalities. In the case of the POP3
protocol, the POP3 client is installed on the recipient system while the POP3 server is installed on the
recipient's mail server.
56.4M
1.2K
The first version of post office protocol was first introduced in 1984 as RFC 918 by
the internet engineering task force. The developers developed a simple and effective email protocol
known as the POP3 protocol, which is used for retrieving the emails from the server. This provides the
facility for accessing the mails offline rather than accessing the mailbox offline.
In 1985, the post office protocol version 2 was introduced in RFC 937, but it was replaced with the
post office protocol version 3 in 1988 with the publication of RFC 1081. Then, POP3 was revised for
the next 10 years before it was published. Once it was refined completely, it got published on 1996.
Although the POP3 protocol has undergone various enhancements, the developers maintained a
basic principle that it follows a three-stage process at the time of mail retrieval between the client and
the server. They tried to make this protocol very simple, and this simplicity makes this protocol very
popular today.
Once the client retrieves all the emails from the server, all the emails from the server are deleted.
Therefore, we can say that the emails are restricted to a particular machine, so it would not be
possible to access the same mails on another machine. This situation can be overcome by
configuring the email settings to leave a copy of mail on the mail server.
o It allows the users to read the email offline. It requires an internet connection only at the time
of downloading emails from the server. Once the mails are downloaded from the server, then
all the downloaded mails reside on our PC or hard disk of our computer, which can be
accessed without the internet. Therefore, we can say that the POP3 protocol does not require
permanent internet connectivity.
o It provides easy and fast access to the emails as they are already stored on our PC.
o It requires less server storage space as all the mails are stored on the local machine.
o There is maximum size on the mailbox, but it is limited by the size of the hard disk.
o If the emails are downloaded from the server, then all the mails are deleted from the server by
default. So, mails cannot be accessed from other machines unless they are configured to
leave a copy of the mail on the server.
o Transferring the mail folder from the local machine to another machine can be difficult.
o Since all the attachments are stored on your local machine, there is a high risk of a virus
attack if the virus scanner does not scan them. The virus attack can harm the computer.
o The email folder which is downloaded from the mail server can also become corrupted.
o The mails are stored on the local machine, so anyone who sits on your machine can access
the email folder.
o POP3 (Post Office Protocol 3) and IMAP (Internet Message Access Protocol) both are MAA
(Message accessing agent), both of these protocols are used to retrieve messages from the
mail server to the receivers system. Both of these protocols are accounted for spam and
virus filters. IMAP is more flexible and complex than POP3.
To read the mail it has to be downloaded The mail content can be read partially before
on the local system. downloading.
The user can not organize mails in the The user can organize the emails directly on the mail
mailbox of the mail server. server.
The user can not create, delete or rename The user can create, delete or rename an email on the
email on the mail server. mail server.
It is unidirectional i.e. all the changes made It is Bi-directional i.e. all the changes made on the
on a device do not affect the content server or device are made on the other side too.
present on the server.
It does not allow a user to sync emails. It allows a user to sync their emails.
A user can not search the content of mail A user can search the content of mail for a specific
before downloading it to the local system. string before downloading.
Changes in the mail can be done using Changes made to the web interface or email software
local email software. stay in sync with the server.
IMAP Protocol
IMAP stands for Internet Message Access Protocol. It is an application layer protocol which is used
to receive the emails from the mail server. It is the most commonly used protocols like POP3 for
retrieving the emails.
It also follows the client/server model. On one side, we have an IMAP client, which is a process
running on a computer. On the other side, we have an IMAP server, which is also a process running
on another computer. Both computers are connected through a network.
The IMAP protocol resides on the TCP/IP transport layer which means that it implicitly uses the
reliability of the protocol. Once the TCP connection is established between the IMAP client and IMAP
server, the IMAP server listens to the port 143 by default, but this port number can also be changed.
POP3 is becoming the most popular protocol for accessing the TCP/IP mailboxes. It implements the
offline mail access model, which means that the mails are retrieved from the mail server on the local
machine, and then deleted from the mail server. Nowadays, millions of users use the POP3
protocol to access the incoming mails. Due to the offline mail access model, it cannot be used as
much. The online model we would prefer in the ideal world. In the online model, we need to be
connected to the internet always. The biggest problem with the offline access using POP3 is that the
mails are permanently removed from the server, so multiple computers cannot access the mails. The
solution to this problem is to store the mails at the remote server rather than on the local server. The
POP3 also faces another issue, i.e., data security and safety. The solution to this problem is to use
the disconnected access model, which provides the benefits of both online and offline access. In the
disconnected access model, the user can retrieve the mail for local use as in the POP3 protocol, and
the user does not need to be connected to the internet continuously. However, the changes made to
the mailboxes are synchronized between the client and the server. The mail remains on the server so
different applications in the future can access it. When developers recognized these benefits, they
made some attempts to implement the disconnected access model. This is implemented by using the
POP3 commands that provide the option to leave the mails on the server. This works, but only to a
limited extent, for example, keeping track of which messages are new or old become an issue when
both are retrieved and left on the server. So, the POP3 lacks some features which are required for the
proper disconnected access model.
In the mid-1980s, the development began at Stanford University on a new protocol that would provide
a more capable way of accessing the user mailboxes. The result was the development of the
interactive mail access protocol, which was later renamed as Internet Message Access Protocol.
The first version of IMAP was formally documented as an internet standard was IMAP version 2, and
in RFC 1064, and was published in July 1988. It was updated in RFC 1176, August 1990, retaining
the same version. So they created a new document of version 3 known as IMAP3. In RFC 1203,
which was published in February 1991. However, IMAP3 was never accepted by the market place, so
people kept using IMAP2. The extension to the protocol was later created called IMAPbis, which
added support for Multipurpose Internet Mail Extensions (MIME) to IMAP. This was a very important
development due to the usefulness of MIME. Despite this, IMAPbis was never published as an RFC.
This may be due to the problems associated with the IMAP3. In December 1994, IMAP version 4, i.e.,
IMAP4 was published in two RFCs, i.e., RFC 1730 describing the main protocol and RFC 1731
describing the authentication mechanism for IMAP 4. IMAP 4 is the current version of IMAP, which is
widely used today. It continues to be refined, and its latest version is actually known as IMAP4rev1
and is defined in RFC 2060. It is most recently updated in RFC 3501.
IMAP Features
IMAP was designed for a specific purpose that provides a more flexible way of how the user accesses
the mailbox. It can operate in any of the three modes, i.e., online, offline, and disconnected mode. Out
of these, offline and disconnected modes are of interest to most users of the protocol.
o Access and retrieve mail from remote server: The user can access the mail from the remote
server while retaining the mails in the remote server.
o Set message flags: The message flag is set so that the user can keep track of which
message he has already seen.
o Manage multiple mailboxes: The user can manage multiple mailboxes and transfer messages
from one mailbox to another. The user can organize them into various categories for those
who are working on various projects.
o Downloads a portion of a message: It allows you to download the portion of a message, such
as one body part from the mime-multi part. This can be useful when there are large
multimedia files in a short-text element of a message.
o Organize mails on the server: In case of POP3, the user is not allowed to manage the mails
on the server. On the other hand, the users can organize the mails on the server according to
their requirements like they can create, delete or rename the mailbox on the server.
o Check email-header: Users can also check the email-header prior to downloading.
o Create hierarchy: Users can also create the folders to organize the mails in a hierarchy.
1. The IMAP is a client-server protocol like POP3 and most other TCP/IP application protocols.
The IMAP4 protocol functions only when the IMAP4 must reside on the server where the user
mailboxes are located. In c the POP3 does not necessarily require the same physical server
that provides the SMTP services. Therefore, in the case of the IMAP protocol, the mailbox
must be accessible to both SMTP for incoming mails and IMAP for retrieval and modifications.
2. The IMAP uses the Transmission Control Protocol (TCP) for communication to ensure the
delivery of data and also received in the order.
3. The IMAP4 listens on a well-known port, i.e., port number 143, for an incoming connection
request from the IMAP4 client.
The IMAP protocol synchronizes all the devices with the main server. Let's suppose we have three
devices desktop, mobile, and laptop as shown in the above figure. If all these devices are accessing
the same mailbox, then it will be synchronized with all the devices. Here, synchronization means that
when mail is opened by one device, then it will be marked as opened in all the other devices, if we
delete the mail, then the mail will also be deleted from all the other devices. So, we have
synchronization between all the devices. In IMAP, we can see all the folders like spam, inbox, sent,
etc. We can also create our own folder known as a custom folder that will be visible in all the other
devices.
Advantages
The advantages of IMAP are as follows −
It allows us to create our email messages from anywhere, via as many different devices as
you want.
It can only download a message when we click on it. As a result, we do not have to wait for all
of our new messages to download from the server before we can read them.
The attachments are not automatically downloaded with IMAP. As a result, you’re able to
check your messages a lot more quickly and have greater control over which attachments are
opened.
IMAP can be used offline, just like the Post Office Protocol (POP).
It includes the ability to delete messages, search for keywords in the body of emails, create
and manage multiple mailboxes or folders, and view the headings for easy visual scans of
emails.
Email Messaging
For email messaging, every domain has email server computer set-up. These email servers run
protocol software that enables electronic communication. There are two main email protocols, POP
and SMTP.
POP is concerned with the retrieval of an email message stored on a server computer, whereas
SMTP is actually responsible for transmitting an email to the user.
Internet Message Access Protocol (IMAP) is an application layer protocol that operates as a
contract for receiving emails from the mail server. It was designed by Mark Crispin in 1986 as a
remote access mailbox protocol, the current version of IMAP is IMAP4. It is used as the most
commonly used protocol for retrieving emails. This term is also known as Internet mail access
protocol, Interactive mail access protocol, and Interim mail access protocol.
Features of IMAP :
It is capable of managing multiple mailboxes and organizing them into various categories.
Provides adding of message flags to keep track of which messages are being seen.
It is capable of deciding whether to retrieve email from a mail server before downloading.
It makes it easy to download media when multiple files are attached.
Working of IMAP :
IMAP follows Client-server Architecture and is the most commonly used email protocol. It is a
combination of client and server process running on other computers that are connected through a
network. This protocol resides over the TCP/IP protocol for communication. Once the
communication is set up the server listens on port 143 by default which is non-encrypted. For the
secure encrypted communication port, 993 is used.
Architecture of IMAP :
Advantages:
It offers synchronization across all the maintained sessions by the user.
It provides security over POP3 protocol as the email only exists on the IMAP server.
Users have remote access to all the contents.
It offers easy migration between the devices as it is synchronized by a centralized server.
There is no need to physically allocate any storage to save contents.
Disadvantages:
IMAP is complex to maintain.
Emails of the user are only available when there is an internet connection.
It is slower to load messages.
Some emails don’t support IMAP which makes it difficult to manage.
Many browser-based solutions are unavailable due to not support of IMAP.
Here the browser displays a web page on the client machine when the user clicks on a line of text that
is linked to a page on abd.com, the browser follows the hyperlink by sending a message to the
abd.com server asking for the page.
Working of WWW:
The World Wide Web is based on several different technologies: Web browsers, Hypertext Markup
Language (HTML) and Hypertext Transfer Protocol (HTTP).
A Web browser is used to access web pages. Web browsers can be defined as programs which
display text, data, pictures, animation and video on the Internet. Hyperlinked resources on the World
Wide Web can be accessed using software interfaces provided by Web browsers. Initially, Web
browsers were used only for surfing the Web but now they have become more universal. Web
browsers can be used for several tasks including conducting searches, mailing, transferring files, and
much more. Some of the commonly used browsers are Internet Explorer, Opera Mini, and Google
Chrome.
Features of WWW:
HyperText Information System
Cross-Platform
Distributed
Open Standards and Open Source
Uses Web Browsers to provide a single interface for many services
Dynamic, Interactive and Evolving.
“Web 2.0”
1. Uniform Resource Locator (URL): serves as a system for resources on the web.
2. HyperText Transfer Protocol (HTTP): specifies communication of browser and server.
3. Hyper Text Markup Language (HTML): defines the structure, organisation and content of a
webpage.
Introduction of Firewall
A firewall is a network security device, either hardware or software-based, which monitors all
incoming and outgoing traffic and based on a defined set of security rules it accepts, rejects or
drops that specific traffic.
Accept : allow the traffic
Reject : block the traffic but reply with an “unreachable error”
Drop : block the traffic with no reply
A firewall establishes a barrier between secured internal networks and outside untrusted network,
such as the Internet.