Computer Networks: Unit-3
Computer Networks: Unit-3
Unit-3
By
P.Jayalakshmi. AP/CSE
DNS(Domain Name System)
● TCP/IP protocols uses IP address.
● Identifies connection of a host to the internet.
● System maps a name to an address
● Host file – only two columns (name, address)
● Single host file – maps the names to address
● Host file would be large to store in every host.
● Impossible to update the changes happens every time to the host file.
Solution 1
● Store the host file in a single system and allow the centralized information access to every system that
needs mapping.
Disadvantage
● Huge amount of traffic to the internet.
Solution 2
● Divide the huge amount of information into smaller parts and store on different systems.
● Host which needs mapping can communicate to the closest system that holds the information.
● This solution is called Domain Name System.
18CSC302J- School of Computing (Odd sem 2020)
Purpose of DNS
Six steps to map host name to an IP address
1. User passes the host name to the file transfer client (FTC).
2. FTC passes the host name to DNS client.
3. DNS client sends a message to the DNS Server. The query gives
the file transfer server name using the known IP address of the
DNS server.
4. DNS server responses back with the IP address of the desired file
transfer server.
5. DNS client passes the IP address to file transfer server.
6. FTC uses the IP address it received to access the file transfer
server.
Two Connections must be made
● Mapping the name to an IP address
● Transferring files
Namespace
● Maps the address to the unique names.
● Organized in two ways flat or hierarchical.
Flat Name Space
● Name is assigned to an address, name is the sequence of characters without structures.
Disadvantage
● Cannot used in large system.
● Centrally controlled to avoid ambiguity and duplications.
Hierarchical Name Space
● Each name is made up of several parts.
● First part – nature of organization
● Second part – name of an organization
● Third part – departments in the organization
● Namespace can be decentralized.
● Suffixes (or prefixes) are added to the name that defines the host or system.
Domain Name Space
✔ Hierarchical name space – DNS was designed.
✔ Names are defined in inverted tree structure
with root at top.
✔ Tree have 128 levels – 0 (root) to 127.
Label
✔ Each node in a tree has a label – max of 63
characters.
Domain Name System ✔ Root label is a null string.
✔ Children node should have different labels that
will ensure uniqueness in domain names.
Domain Name
✔ Full domain name is the sequence of labels
separated by dots.
✔ Domain names read from nodes up to the root.
✔ Full domain name always ends in a null label.
Domain names and labels
Fully Qualified Domain Names (FQDN)
Partially Qualified Domain Names (PQDN)
Fully Qualified Domain Names (FQDN)
● If the label is terminated by null string it is called fully qualified domain
names.
● Contains the full name of the host, contains all labels from most specific to
most general.
● DNS server can match an FQDN to an address.
Eg: challenger.atc.fhda.edu.
Primary Server
● Server that stores the file about the zone for which it is in authority.
● It is responsible for creating, maintaining and updating the zone files.
● It stores zone file on a local disk.
Secondary Servers
● Server that transfers the complete information about zone from another server and stores the file on its
local disk.
● Secondary server neither creates nor updates the zone files.
DNS in the Internet
● In internet the domain name space is divided into three
different sections.
● Generic domains, country domains and the inverse domains.
Generic Domains
● Define registered hosts according to their generic behaviour.
● Each node in a tree defines a domain which is an index to the
DNS used in internet domain name space database.
Country Domains
Inverse Domain
● It is used to map an address to a name.
● This happens when the server has received a request
from the client.
● Type of query called an inverse or pointer (PTR) query.
● To handle the pointer query the inverse domain is
added to the domain name space with the first level
node.
● Second level is also one single node named in addr (for
Inverse Domain
inverse address).
Resolution
Mapping a name to an address or an address to a name is called name
address resolution.
Resolver
● DNS is designed as a client – server application.
● Host that needs to map an address to a name or a name to an
address calls a DNS client called a resolver.
● After the resolver receives the mapping, it interprets the response
to see if it is a real resolution or an error and finally delivers the
results to the process that requested it.
Mapping Names to Addresses
● The resolver gives a domain name to the server and asks for the
corresponding address.
● If the domain name is from the generic domain the resolver
receives a domain name such as “chal.atc.fhda.edu.
● if the domain name is from the country domain the resolver
receives a domain name such as “ch.fhda.cu.ca.us.
Resolution
Mapping Addresses to Names
● A client can send an IP address to a server to be mapped to a
domain name.
● To answer the PTR query DNS uses the inverse domain.
● in the request the IP address is reversed and two labels in-
addr and arpa are appended to create a domain acceptable by
the inverse domain.
Recursive resolution
Recursive Resolution
● The client can ask for a recursive answer from a name server.
● If the server is the authority for the domain name, it checks its
database and responds.
● If the server is not the authority it sends the request to
another server and waits for the response.
● If the parent is the authority it responds otherwise it sends the
query to another server.
Resolution
Iterative Resolution
● If server is an authority for the name it sends the answer.
● If not it returns the IP address of the server that thinks it can
resolve the query.
● The client is responsible for repeating the request to the second
server.
● The client repeats the same procedure to next server and so on
● This process is called iterative because the client repeats the
same query to multiple servers.
Catching
● Each time the server receives the query for a name that is not in
Iterative Resolution
domain it needs to search its database for a server IP address.
● Reduction in search time would increase the efficiency.
● DNS handles this with the mechanism called catching.
Resolution
● Reduction of search time would increase the efficiency.
● DNS handles this with the mechanism called catching.
● Catching speeds up resolution but it can also be problematic.
● If the server catches the mapping for a long time it may send an outdated mapping to the client.
⮚ DNS requires each server keep a TTL counter for each mapping it caches.
DNS Messages
● DNS messages are of two types
⮚ Query
⮚ Response
Flags Field
0 – standard
1 – inverse
2 – server status request
DNS Messages
● AA (Authoritative Answer) – 1 bit subfield
Set to 1 - name server is the authoritative server
Used only in response message.
● TC (Truncate) – 1 bit subfield
Set to 1 – response was more than 512 bytes and
truncated
It is used when DNS uses the services of UDP
● RD (Recursion Desired) – 1 bit subfield
Flags Field Set to 1 – client desires a recursive answer
It is set in query message and repeated in the
response message
● RA (Recursion Available) – 1 bit subfield
Set in response, means that a recursive response
is available
Set only in response message
DNS Messages
● Reserved – 3 bit sub field set to 000.
rcode – 4 bit field shows status of error in response
Only authoritative server can make the judgement
Flags Field ● Number of question records – 16 bit field
Contains the number of queries in question section
of the message
● Number of answer records – 16 bit field
Contains the number of answer records in answer
section of the response message
● Number of authoritative records – 16 bit field
Contains number of authoritative records in
Values of rcode authoritative section of the response message
It’s value is zero in query message
● Number of additional records – 16 bit field
Contains number of additional records in additional
section of a response message
DNS Messages
● Question Section
Consists of one or more question records
It is present in both query and response messages
● Answer Section
Consists of two or more resource records
It is present only on response messages
● Authoritative Section
Consists of two or more resource records
It is present only on response messages
Gives information (domain name) about one or more authoritative servers for the query
● Additional Information Section
Consists of two or more resource records
It is present only on response messages
Gives additional information that helps the resolver
TELNET & SSH
TELNET
• Heterogeneous networks
• remote computer- type of the computer to be known
• The client TELNET translates characters (data or commands) that come from the local terminal into NVT
form and delivers them to the network.
• The server TELNET, on the other hand, translates data and commands from NVT form into the form
acceptable by the remote computer.
NVT Character Set
● the client and server are given equal opportunity NVT character set for sub option negotiation
● both are using a default TELNET implementation with no options
enabled.
● If one party wants an option enabled, it can offer or request. The
other party has the right to approve the offer or reject the request • To define the type or speed of a terminal,
if the party is not capable of using the option or does not want to the negotiation includes a string or a
Port Forwarding
• Length. This 4-byte field defines the length of the packet including the
type, the data, and the CRC field, but not the padding and the length
field.
• Padding. One to eight bytes of padding is added to the packet to make
the attack on the security provision more difficult.
• Type. This one-byte field defines the type of the packet used by SSH
protocols.
• Data. This field is of variable length. The length of the data can be found
by deducting the five bytes from the value of the length field.
• CRC. The cyclic redundancy check filed is used for error detection
FTP & TFTP
FTP
● File Transfer Protocol (FTP) is the standard mechanism provided by TCP/IP for copying a file from one host to another.
● FTP uses the services of TCP. It needs two TCP connections.
● The well-known port 21 is used for the control connection and the well-known port 20 for the data connection.
Control Connection
● The control connection is created in the same way as other application programs described so far. There are two steps:
• The server issues a passive open on the well-known port 21 and waits for a client.
• The client uses an ephemeral port and issues an active open.
Data Connection
Two ways
Access Commands
Miscellaneous commands
File Transfer
Anonymous FTP
● To use FTP, a user needs an account (user name) and a password on the remote server.
● Some sites have a set of files available for public access.
● To access these files, a user does not need to have an account or password.
● Instead, the user can use anonymous as the user name and guest as the password.
● User access to the system is very limited.
● Some sites allow anonymous users only a subset of commands.
● For example, most sites allow the user to copy some files, but do not allow navigation through the directories.
Security for FTP
● The FTP protocol was designed when the security was not a big issue.
● Although FTP requires a password, the password is sent in plaintext (unencrypted), which means it can be intercepted
and used by an attacker.
● The data transfer connection also transfers data in plaintext, which is insecure.
● To be secure, one can add a Secure Socket Layer between the FTP application layer and the TCP layer : SSL-FTP.
FTP Vs TFTP
TFTP
● TFTP is good for simple file
transfers, such as during RRQ format
boot time fits on ROM
requires only IP & UDP
WRQ format
● No security for TFTP. TFTP
can read or write a file for
the client
Data format
● Sites
Client Server
Response
Hypertext and Hypermedia
● Hypertext –creating a document that in turn refer to other
document. In a hypertext document, a part of text can be
defined as a link to another document.
● Hypermedia is a term applied to document that contains
links to other textual document or documents containing
graphics, video, or audio.
Web Client (Browser)
● It is an application software that allows us to view and
explore information on the web. User can request for any
web page by just entering a URL into address bar.
● Web browser can show text, audio, video, animation and
more. It is the responsibility of a web browser to interpret
text and commands contained in the web page.
● A variety of vendors offer commercial browsers that
interpret and display a Web document, and all of them use
nearly the same architecture. Each browser usually consists
Web Server
● Web site is collection of web pages while web server is a
software that respond to the request for web resources.
● When client sends request for a web page, the web server
search for the requested page if requested page is found
then it will send it to client with an HTTP response.
● If the requested web page is not found, web server will the
send an HTTP response : Error 404 Not found.
● A server can also become more efficient through
multithreading or multiprocessing. In this case, a server can
Uniform Resource Locator (URL)
● A URL (Uniform Resource Locator) is a unique identifier
used to locate a resource on the internet.
● Request message
● Request Line
HTTP Transaction (Cont . . .)
● Format of request message and response message
Conditional Request
● Request based on condition is possible.
● If condition is met, server sends it; else client is informed
about it.
● Example conditions - time and date the Web page is
modified.
○ Request
GET http://www.commonServer.com/information/file1
HTTP/1.1
Persistence
● HTTP version 1.1 specifies a persistent connection by
default.
● Connection is left open for more requests.
● Connection will be closed only after a request or if a time-
out is reached.
● Length of data is sent by the sender on each response, but if
it is unknown (Dynamic documents) then the server informs
client and closes the connection.
Cookies
● It is a small piece of data stored in users system by the
browser while browsing a website.
● When the client receives the response from server on
request, the browser stores the cookie in the cookie
directory.
● Next time, when a client sends a request to a server, the
browser looks in the cookie directory to
● see if it can find a cookie sent by that server. If found, the
cookie is included in the request.
Web caching: Proxy server
● Proxy server acts as a gateway between client and server.
● It keeps copies of responses to recent requests.
● On receiving the request from client, proxy server checks its
cache and if it is not found then the request is sent to
corresponding server.
● This reduces the load on the original server, decreases
traffic, and improves latency.
● However, to use the proxy server, the client must be
configured to access the proxy instead of the target server.
HTTP security
● HTTPS provides confidentiality, client and server
authentication, and data integrity.
DHCP
Introduction
● Every computer that utilizes TCP/IP protocol should know its IP address.
● In addition to this, Subnet mask is also needed, if the computer is under a subnet.
● The other two information needed for most of the recent machines are
■ Checksum
■ Retransmission
• First Scenario
• Second Scenario
• Third Scenario
• Fourth Scenario
First scenario
• The sender and the receiver of the e-mail are users on the same mail server; they are directly connected to
a shared mail server.
• The admin has created one mailbox to store the received messages. Only the sender or the receiver of the
mailbox has access to it.
First scenario(Contd..)
• When Alice needs to send a message to Bob, she runs a user
agent( is a program) to prepare the message and store it in
Bob’s mailbox.
• Alice needs to use a user agent to send her message to the mail server at her own site. The mail server at
her site uses a buffer (queue) to store messages waiting to be sent.
• Bob also needs a user agent to retrieve messages stored in the mailbox of the system at his site. Here two
message transfer agents are needed: one client and one server.
• The server needs to run all of the time because it does not know when a client will ask for a connection.
The client, on the other hand, can be triggered by the system when there is a message in the queue to be
sent.
Third scenario
Third scenario (Contd..)
• Alice needs a user agent to prepare her message. She then needs to send the message through the LAN or
WAN.
• This can be done through a pair of message transfer agents (client and server). Whenever Alice has a
message to send, she calls the user agent which, in turn, calls the MTA client.
• The MTA client establishes a connection with the MTA server on the system, which is running
continuously. The system at Alice’s site queues all messages received.
• It then uses an MTA client to share the messages to the system at Bob’s site; the system receives the
message and stores it in Bob’s mailbox.
Fourth scenario
Fourth scenario (Contd..)
• Here, Bob is also connected to his mail server by a WAN or a LAN. After the message has arrived at Bob’s
mail server, Bob needs to retrieve it.
• Here, we need another set of client-server agents, which we call message access agents (MAAs).
• Bob uses an MAA client to retrieve his messages. The client sends a request to the MAA server, which is
running all the time, and requests the transfer of the messages.
• Bob cannot bias the mail server to use the MTA server directly. To use the MTA server directly, Bob would
need to run the MTA server all the time because he does not know when a message will arrive.
Push vs Pull
o Here, Bob needs another pair of client-server programs: message access programs. This is because an
MTA client-server program is a push program:
o The client pushes the message to the server. Bob needs a pull program. The client needs to pull the
message from the server.
User Agent
• The first component of an electronic mail system is the user agent (UA). It provides service to the user to
make the process of sending and receiving a message easier.
● SMTP uses commands and responses to transfer messages between an MTA client and an MTA server.
Commands
● Commands are sent from the client to the server.
Responses
• The server sends code 220 to tell the client that it is ready to receive mail.
• The client sends the HELO message to identify itself using its domain name address. This step is necessary
to inform the server of the domain name of the client.
• The server responds with code 250
Mail Transfer
• The client sends the message to introduce the sender of the message. It includes the mail address of the
sender. This step is needed to give the server the return mail address for reporting messages.
• The server responds with code.
• The client sends the message, which includes the mail, that address of the recipient.
• The server responds with code.
• The client sends the DATA message to initialize the message transfer.
• The server responds with code to start mail input.
• The client sends the contents of the message in consecutive lines. Each line is terminated by a two-
character end-of-line token.
• The server responds with code.
Mail transfer
Connection termination
● When the message is transferred successfully, the client terminates the connection.
Message access agent
• The first and the second stages of mail delivery use SMTP. Here, SMTP is not involved in the third stage
because SMTP is a push protocol; it pushes the message from the client to the server.
• The third stage needs a pull protocol; the client must pull messages from the server. The direction of the
bulk data are from the server to the client.
• The third stage uses a message access agent. Currently two message access protocols are available: Post
Office Protocol, version 3 (POP3) and Internet Mail Access Protocol, version 4 (IMAP4).
POP3 & IMAP4
POP3(Post Office Protocol, version 3):
• The client POP3 software is installed on the recipient computer; the server POP3 software is installed
on the mail server. Mail access starts with the client when the user needs to download its e-mail from
the mailbox.
• The client opens a connection to the server on TCP port. It then sends its user name and password to
access the mailbox. The user can then list and retrieve the mail messages, one by one.
POP3 & IMAP4 (Contd..)
IMAP4(Internet Mail Access Protocol, version 4): It is more powerful and more complex.
IMAP4 provides the following extra functions:
o A user can check the e-mail header prior to downloading.
o A user can search the contents of the e-mail for a specific string of characters prior to downloading.
o A user can partially download e-mail. This is especially useful if bandwidth is limited and the e-mail
contains multimedia with high bandwidth requirements.
o A user can create, delete, or rename mailboxes on the mail server.
o A user can create a hierarchy of mailboxes in a folder for e-mail storage.
MIME
• E - mail has a simple structure. It can send messages only in NVT 7-bit ASCII format. Multipurpose
Internet Mail Extensions (MIME) is a supplementary protocol that allows non-ASCII data to be sent
through e-mail.
• MIME transforms non-ASCII data at the sender site to NVT ASCII data and delivers it to the client MTA
to be sent through the Internet.
• The message at the receiving site is transformed back to the original data.
MIME header
MIME header (Contd..)
● MIME-Version: This header defines the version of MIME used. The current version is 1.1.
● Content-Type :