CN-Module 5 Notes
CN-Module 5 Notes
Providing Services
• All communication networks that started before the Internet were designed to provide
services to network users.
• The protocols in this layer do not provide services to any other protocol in the suite;
they only receive services from the protocols in the transport layer.
• This means that protocols can be removed from this layer easily.
• New protocols can be also added to this layer as long as the new protocols can use the
services provided by one of the transport-layer protocols.
Standard and Nonstandard Protocols
• The protocols used in the first four layers of the TCP/IP suite need to be standardized
and documented.
• They normally become part of the package that is included in operating systems such
as Windows or UNIX.
• However, the application-layer protocols can be both standard and nonstandard.
• There are several application-layer protocols that have been standardized and
documented by the Internet authority.
• Each standard protocol is a pair of computer programs that interact with the user and
the transport layer to provide a specific service to the user.
Application-Layer Paradigms
• To use the Internet, we need two application programs to interact with each other,
running on two different devices.
• The two programs need to send messages to each other through the Internet
infrastructure.
• Two paradigms have been developed: the client-server paradigm and the peer-to-peer
paradigm.
Traditional Paradigm: Client-Server
• The traditional paradigm is called the client-server paradigm.
• In this paradigm, the service provider is called the server process; it runs continuously,
waiting for another application program, called the client process, to make a connection
through the Internet and ask for service.
• The server process must be running all the time; the client process is started when the
client needs to receive service.
• For example, a telephone directory center in any area can be thought of as a server; a
subscriber that calls and asks for a specific telephone number can be thought of as a
client.
• Although the communication in the client-server paradigm is between two application
programs, the role of each program is totally different. We cannot run a client program
as a server program or vice versa.
• Figure 25.2 shows an example of a client-server communication in which three clients
communicate with one server to receive the services provided by this server.
• One problem with this paradigm is that even a powerful computer may become
overwhelmed if a large number of clients try to connect to the server at the same time.
• Another problem is that there should be a service provider willing to accept the cost
and create a powerful server for a specific service.
• Several traditional services are still using this paradigm, including the World Wide Web
(WWW) and its vehicle HyperText Transfer Protocol (HTTP), file transfer protocol
(FTP), secure shell (SSH), e-mail, and so on.
New Paradigm: Peer-to-Peer
• A new paradigm, called the peer-to-peer paradigm (P2P paradigm) has emerged to
respond to the needs of some new applications.
• In this paradigm, there is no need for a server process to be running all the time and
waiting for the client processes to connect.
• The responsibility is shared between peers.
• A computer connected to the Internet can provide service or receive service. A computer
can even provide and receive services at the same time.
• For example, if an Internet user has a file available to share with other Internet users,
there is no need for the file holder to become a server and wait for other users to connect
and retrieve the file.
• Although the peer-to-peer paradigm has been proved to be easily scalable and cost-
effective, there are also some challenges.
• The main challenge has been security; it is more difficult to create secure
communication between distributed services than between those controlled by some
dedicated servers.
• The other challenge is applicability; it appears that not all applications can use this new
paradigm.
• There are some new applications, such as BitTorrent, Skype, IPTV, and Internet
telephony, that use this paradigm.
Mixed Paradigm
• An application may choose to use a mixture of the two paradigms by combining the
advantages of both.
• For example, a light-load client-server communication can be used to find the address
of the peer that can offer a service.
• When the address of the peer is found, the actual service can be received from the peer
by using the peer-to peer paradigm.
CLIENT-SERVER PROGRAMMING
• In a client-server paradigm, communication at the application layer is between two
running application programs called processes: a client and a server.
• A client is a running program that initializes the communication by sending a request;
a server is another application program that waits for a request from a client.
• The server handles the request received from a client, prepares a result, and sends the
result back to the client.
• This definition of a server implies that a server must be running when a request from a
client arrives, but the client needs to be run only when it is needed.
Application Programming Interface
• A computer program is normally written in a computer language with a predefined set
of instructions that tells the computer what to do.
• If we need a process to be able to communicate with another process, we need a new
set of instructions to tell the lowest four layers of the TCP/IP suite to open the
connection, send and receive data from the other end, and close the connection.
• A set of instructions of this kind is normally referred to as an application programming
interface (API).
• An interface in programming is a set of instructions between two entities. In this case,
one of the entities is the process at the application layer and the other is the operating
system that encapsulates the first four layers of the TCP/IP protocol suite.
• Several APIs have been designed for communication. Three among them are common:
socket interface, Transport Layer Interface (TLI), and STREAM.
• Socket interface started in the early 1980s at UC Berkeley as part of a UNIX
environment.
• The socket interface is a set of instructions that provide communication between the
application layer and the operating system.
• The idea of sockets allows us to use the set of all instructions already designed in a
programming language for other sources and sink, such as a keyboard (a source), a
monitor (a sink), or a file (source and sink).
• We can use the same instructions to read from or write to sockets.
Sockets
• Although a socket is supposed to behave like a terminal or a file, it is not a physical entity
like them; it is an abstraction.
• It is an object that is created and used by the application program.
• The client thinks that the socket is the entity that receives the request and gives the
response; the server thinks that the socket is the one that has a request and needs the
response.
• If we create two sockets, one at each end, and define the source and destination addresses
correctly, we can use the available instructions to send and receive data.
• The rest is the responsibility of the operating system and the embedded TCP/IP protocol.
Socket Addresses
• A socket address should first define the computer on which a client or a server is
running, uniquely defined by its IP address.
• However, several client or server processes may be running at the same time on a
computer, which means that we need another identifier to define the specific client or
server involved in the communication.
• An application program can be defined by a port number, a 16-bit integer.
• A socket address should be a combination of an IP address and a port number as shown
in Figure 25.7.
Server Site
The server needs a local (server) and a remote (client) socket address for communication.
Local Socket Address
• The local (server) socket address is provided by the operating system.
• The operating system knows the IP address of the computer on which the server process
is running.
• The port number of a server process, however, needs to be assigned. If the server
process is a standard one defined by the Internet authority, a port number is already
assigned to it.
• For example, the assigned port number for a Hypertext Transfer Protocol (HTTP) is the
integer 80.
• If the server process is not standard, the designer of the server process can choose a port
number, in the range defined by the Internet authority, and assign it to the process.
Remote Socket Address
• The remote socket address for a server is the socket address of the client that makes the
connection.
• The server can find this socket address when a client tries to connect to the server.
• The client socket address, which is contained in the request packet sent to the server,
becomes the remote socket address that is used for responding to the client.
Client Site
• The client also needs a local (client) and a remote (server) socket address for
communication.
Local Socket Address
• The local (client) socket address is also provided by the operating system.
• The operating system knows the IP address of the computer on which the client is
running.
• The port number, however, is a 16-bit temporary integer that is assigned to a client
process each time the process needs to start the communication.
Remote Socket Address
When a client process starts, it should know the socket address of the server it wants to connect
to.
Two situations in this case:
1. Sometimes, the user who starts the client process knows both the server port number
and IP address of the computer on which the server is running. This usually occurs in
situations when we have written client and server applications and we want to test them.
2. The client process normally knows the port number because it should be a well-known
port number, but the IP address can be obtained using another client-server application
called the Domain Name System (DNS).
• DNS acts as a directory in the Internet, that maps the server name to the IP address of
the computer running that server.
UDP Protocol
• UDP provides connectionless, unreliable, datagram service. Connectionless service
means that there is no logical connection between the two ends exchanging messages.
• Each message is an independent entity encapsulated in a datagram.
• UDP is not a reliable protocol. UDP is not a reliable protocol. It does not ask the sender
to resend the corrupted or lost datagram.
• UDP is message-oriented. It gives boundaries to the messages exchanged.
• An application program may be designed to use UDP if it is sending small messages
and the simplicity and speed is more important for the application than reliability.
• For example, some management and multimedia applications fit in this category.
TCP Protocol
• TCP provides connection-oriented, reliable, byte-stream service.
• TCP requires that two ends first create a logical connection between themselves by
exchanging some connection-establishment packets.
• This phase, which is sometimes called handshaking, establishes some parameters
between the two ends, including the size of the data packets to be exchanged, the size
of buffers, and so on.
• After the handshaking process, the two ends can send chunks of data in segments in
each direction.
• For example, if some bytes are lost or corrupted, the receiver can request the resending
of those bytes, which makes TCP a reliable protocol.
• TCP also can provide flow control and congestion control.
• One problem with the TCP protocol is that it is not message-oriented; it does not put
boundaries on the messages exchanged.
• Most of the standard applications that need to send long messages and require reliability
may benefit from the service of the TCP.
SCTP Protocol
• SCTP provides a service which is a combination of the two other protocols.
• Like TCP, SCTP provides a connection-oriented, reliable service, but it is not byte
stream oriented.
• It is a message-oriented protocol like UDP. In addition, SCTP can provide multi-stream
service by providing multiple network-layer connections.
• SCTP is normally suitable for any application that needs reliability and at the same time
needs to remain connected, even if a failure occurs in one network-layer connection.
Flow Diagram
Below figure shows a simplified flow diagram for iterative communication using TCP. There
are multiple clients, but only one server. Each client is served in each iteration of the loop.
Server Process
• The TCP server process, like the UDP server process, creates a socket and binds it, but
these two commands create the listen socket to be used only for the connection
establishment phase.
• The server process then calls the listen procedure, to allow the operating system to start
accepting the clients, completing the connection phase, and putting them in the waiting
list to be served.
• The server process now starts a loop and serves the clients one by one.
• If the list is empty, the accept procedure blocks until there is a client to be served. When
the accept procedure returns, it creates a new socket for data transfer.
• At this time the client and server can exchange data.
Client Process
The client flow diagram is almost similar to the UDP version except that the client data-transfer
box needs to be defined for each specific case.
Concurrent Communication
• A concurrent server can process several client requests at the same time. This can be
done using the available provisions in the underlying programming language.
• In C, a server can create several child processes, in which a child can handle a client.
• In Java, threading allows several clients to be handled by each thread.
World Wide Web and HTTP
• World Wide Web The idea of the Web was first proposed by Tim Berners-Lee in 1989
at CERN, the European Organization for Nuclear Research.
• The Web today is a repository of information in which the documents, called web pages,
are distributed all over the world and related documents are linked together.
• The popularity and growth of the Web can be related to: distributed and linked.
• Distribution allows the growth of the Web. Each web server in the world can add a new
web page to the repository and announce it to all Internet users without overloading a
few servers.
• Linking allows one web page to refer to another web page stored in another server
somewhere else in the world.
• The linking of web pages was achieved using a concept called hypertext.
• Today, the Web is used to provide electronic shopping and gaming. One can use the
Web to listen to radio programs or view television programs whenever one desires.
Architecture
• The WWW today is a distributed client-server service, in which a client using a browser
can access a service using a server.
• The service provided is distributed over many locations called sites. Each site holds one
or more web pages. A simple web page has no links to other web pages; a composite
web page has one or more links to other web pages. Each web page is a file with a name
and address.
Example:
Assume we need to retrieve a scientific document that contains one reference to another text
file and one reference to a large image. The main document and the image are stored in two
separate files (file A and file B) in the same site; the referenced text file (file C) is stored in
another site. Since we are dealing with three different files, we need three transactions if we
want to see the whole document.
Web Client (Browser)
• A variety of vendors offer commercial browsers that interpret and display a web page,
and all of them use nearly the same architecture.
• Each browser usually consists of three parts: a controller, client protocols, and
interpreters.
• The controller receives input from the keyboard or the mouse and uses the client
programs to access the document.
• After the document has been accessed, the controller uses one of the interpreters to
display the document on the screen.
• The client protocol can be one of the protocols described later, such as HTTP or FTP.
• The interpreter can be HTML, Java, or JavaScript, depending on the type of document.
Some commercial browsers include Internet Explorer, Netscape Navigator, and Firefox.
Web Server
• The web page is stored at the server. Each time a request arrives, the corresponding
document is sent to the client.
• To improve efficiency, servers normally store requested files in a cache in memory;
memory is faster to access than a disk.
• A server can also become more efficient through multithreading or multiprocessing.
• In this case, a server can answer more than one request at a time. Some popular web
servers include Apache and Microsoft Internet Information Server.
Web Documents
The documents in the WWW can be grouped into three broad categories: static, dynamic, and
active.
Static Documents
• Static documents are fixed-content documents that are created and stored in a server.
The client can get a copy of the document only.
• The contents in the server can be changed, but the user cannot change them.
• When a client accesses the document, a copy of the document is sent.
• Static documents are prepared using one of several languages: HyperText Markup
Language (HTML), Extensible Markup Language (XML), Extensible Style Language
(XSL), and Extensible Hypertext Markup Language (XHTML).
Dynamic Documents
• A dynamic document is created by a web server whenever a browser requests the
document.
• When a request arrives, the web server runs an application program or a script that
creates the dynamic document.
• The server returns the result of the program or script as a response to the browser that
requested the document.
• An example of a dynamic document is the retrieval of the time and date from a server.
• Dynamic document documents are prepared using the scripting languages such as Java
Server Pages (JSP), which uses the Java language for scripting, or Active Server Pages
(ASP), a Microsoft product that uses Visual Basic language for scripting, or
ColdFusion.
Active Documents
• For many applications, we need a program or a script to be run at the client site. These
are called active documents.
• For example, suppose we want to run a program that creates animated graphics on the
screen or a program that interacts with the user.
• The program definitely needs to be run at the client site where the animation or
interaction takes place.
• When a browser requests an active document, the server sends a copy of the document
or a script. The document is then run at the client (browser) site.
• Java applets or JavaScripts are used to create an active document.
Nonpersistent Connections
• In a nonpersistent connection, one TCP connection is made for each request/response.
The following lists the steps in this strategy:
1. The client opens a TCP connection and sends a request.
2. The server sends the response and closes the connection.
3. The client reads the data until it encounters an end-of-file marker; it then closes the
connection.
• In this strategy, if a file contains links to N different pictures in different files (all located
on the same server), the connection must be opened and closed N + 1 times.
• The nonpersistent strategy imposes high overhead on the server because the server
needs N+1 different buffers each time a connection is opened.
• For each connection, TCP requires at least three handshake messages to establish the
connection, but the request can be sent with the third one.
• After the connection is established, the object can be transferred. After receiving an
object, another three handshake messages are needed to terminate the connection.
Persistent Connections
• HTTP version 1.1 specifies a persistent connection by default. In a persistent
connection, the server leaves the connection open for more requests after sending a
response.
• The server can close the connection at the request of a client or if a time-out has been
reached.
• The sender usually sends the length of the data with each response. The length of the
data is not known in case when a document is created dynamically or actively.
• In these cases, the server informs the client that the length is not known and closes the
connection after sending the data so the client knows that the end of the data has been
reached.
• Time and resources are saved using persistent connections. Only one set of buffers and
variables needs to be set for the connection at each site.
• The round trip time for connection establishment and connection termination is saved.
• Only one connection establishment and connection termination is used, but the request
for the image is sent separately.
Message Formats
• The HTTP protocol defines the format of the request and response messages. Each
message has four sections.
• The first section in the request message is called the request line; the first section in the
response message is called the status line. The other three sections have the same names
in the request and response messages.
Request Message:
• The first line in a request message is called a request line. There are three fields in this
line separated by one space and terminated by two characters (carriage return and line
feed). The fields are method, URL, and version.
• The method field defines the request types. In version 1.1 of HTTP, several methods
are defined.
• Most of the time, the client uses the GET method to send a request. In this case, the
body of the message is empty.
• The HEAD method is used when the client needs only some information about the web
page from the server.
• The response message in this case has only the header section; the body section is
empty.
• The PUT method is the inverse of the GET method; it allows the client to post a new
web page on the server (if permitted).
• The POST method is used to send some information to the server to be added to the
web page or to modify the web page.
• The TRACE method is used for debugging; the client asks the server to echo back the
request to check whether the server is getting the requests.
• The DELETE method allows the client to delete a web page on the server if the client
has permission to do so.
• The CONNECT method was originally made as a reserve method; it may be used by
proxy servers.
• Finally, the OPTIONS method allows the client to ask about the properties of a web
page.
After the request line, we can have zero or more request header lines. Each header line sends
additional information from the client to the server.
Response Message:
A response message consists of a status line, header lines, a blank line, and sometimes a body.
• The first line in a response message is called the status line. There are three fields in
this line separated by spaces and terminated by a carriage return and line feed.
• The first field defines the version of HTTP protocol, currently 1.1.
• The status code field defines the status of the request. It consists of three digits.
• The codes in the 100 range are only informational, the codes in the 200 range indicate
a successful request.
• The codes in the 300 range redirect the client to another URL, and the codes in the 400
range indicate an error at the client site.
• Finally, the codes in the 500 range indicate an error at the server site. The status phrase
explains the status code in text form.
After the status line, we can have zero or more response header lines. Each header line sends
additional information from the server to the client. Some header names commonly used in a
response message:
Conditional Request
• A client can add a condition in its request. In this case, the server will send the requested
web page if the condition is met or inform the client otherwise.
• For example, the client can send the header line If-Modified-Since with the request to
tell the server that it needs the page only if it is modified after a certain point in time.
Request:
Response:
Cookies
• The World Wide Web was originally designed as a stateless entity. A client sends a
request; a server responds.
• Today the Web has other functions that need to remember some information about the
clients; some are listed below:
1. Websites are being used as electronic stores that allow users to browse through the
store, select wanted items, put them in an electronic cart, and pay at the end with a
credit card.
2. Some websites need to allow access to registered clients only.
3. Some websites are used as portals: the user selects the web pages he wants to see.
4. Some websites are just advertising agencies.
For these purposes, the cookie mechanism was devised
• In the above example, the proxy server is installed in the local network.
• When an HTTP request is created by any of the clients (browsers), the request is first
directed to the proxy server.
• If the proxy server already has the corresponding web page, it sends the response to the
client.
• Otherwise, the proxy server acts as a client and sends the request to the web server in
the Internet.
• When the response is returned, the proxy server makes a copy and stores it in its cache
before sending it to the requesting client.
Cache Update
The proxy server can store the list of sites whose information remains the same for a while. For
example, a news agency may change its news page every morning. Another recommendation
is to add some headers to show the last modification time of the information. The proxy server
can then use the information in this header to guess how long the information would be valid.
HTTP Security
HTTP does not provide security. However, HTTP can be run over the Secure Socket Layer
(SSL). In this case, HTTP is referred to as HTTPS. HTTPS provides confidentiality, client and
server authentication, and data integrity.
Two Connections
• The two connections in FTP have different lifetimes. The control connection remains
connected during the entire interactive FTP session.
• The data connection is opened and then closed for each file transfer activity.
• It opens each time commands that involve transferring files are used, and it closes when
the file is transferred. FTP uses two well-known TCP ports: port 21 is used for the
control connection, and port 20 is used for the data connection.
Control Connection
• It uses the NVT ASCII character set as used by TELNET. Communication is achieved
through commands and responses.
• Each line is terminated with a two-character (carriage return and line feed) end-of-line
token.
FTP Commands:
• Every FTP command generates at least one response. A response has two parts: a three-
digit number followed by text.
• The numeric part defines the code; the text part defines needed parameters or further
explanations.
• The first digit defines the status of the command. The second digit defines the area in
which the status applies. The third digit provides additional information.
Responses in FTP:
Data Connection
The data connection uses the well-known port 20 at the server site. However, the creation of a
data connection is different from the control connection. The following shows the steps:
1. The client, issues a passive open using an ephemeral port. This must be done by the
client as the client issues the commands for transferring files.
2. Using the PORT command the client sends this port number to the server.
3. The server receives the port number and issues an active open using the well known
port 20 and the received ephemeral port number.
Example:
• A simple e-mail from Alice to Bob takes nine different steps. Alice and Bob use three
different agents: a user agent (UA), a message transfer agent (MTA), and a message
access agent (MAA).
• When Alice needs to send a message to Bob, she runs a UA program to prepare the
message and send it to her mail server.
• The mail server at her site uses a queue (spool) to store messages waiting to be sent.
• The message, however, needs to be sent through the Internet from Alice’s site to Bob’s
site using an MTA.
• Here two message transfer agents are needed: one client and one server. The server
needs to run all 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.
• The user agent at the Bob site allows Bob to read the received message.
• Bob later uses an MAA client to retrieve the message from an MAA server running on
the second server.
• Bob needs another pair of client-server programs: message access programs.
• This is because an MTA client-server program is a push program: 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.
• A user agent is a software package (program) that composes, reads, replies to, and
forwards messages.
• It also handles local mailboxes on the user computers.
• There are two types of user agents: command-driven and GUI-based.
• A command-driven user agent normally accepts a one character command from the
keyboard to perform its task.
• Modern user agents are GUI-based. They contain graphical user interface (GUI)
components that allow the user to interact with the software by using both the keyboard
and the mouse.
• Some examples of GUI-based user agents are Eudora and Outlook.
Sending Mail
• The mail has an envelope and a message. The envelope usually contains the sender
address, the receiver address, and other information.
• The message contains the header and the body. The header of the message defines the
sender, the receiver, the subject of the message, and some other information. The body
of the message contains the actual information to be read by the recipient.
Receiving Mail
• If a user has mail, the UA informs the user with a notice. If the user is ready to read the
mail, a list is displayed in which each line contains a summary of the information about
a particular message in the mail box.
• The summary usually includes the sender mail address, the subject, and the time the
mail was sent or received. The user can select any of the messages and display its
contents on the screen.
Addresses
• To deliver mail, a mail handling system must use an addressing system with unique
addresses.
• In the Internet, the address consists of two parts: a local part and a domain name,
separated by an @ sign.
• The local part defines the name of a special file, called the user mailbox, where all the
mail received for a user is stored for retrieval by the message access agent.
• The second part of the address is the domain name. An organization usually selects one
or more hosts to receive and send e-mail; they are sometimes called mail servers or
exchangers.
Mailing List or Group List
• Electronic mail allows one name, an alias, to represent several different e-mail
addresses; this is called a mailing list.
• Every time a message is to be sent, the system checks the recipient’s name against the
alias database; if there is a mailing list for the defined alias, separate messages, one for
each entry in the list, must be prepared and handed to the MTA.
• POP3 has two modes: the delete mode and the keep mode. In the delete mode, the mail
is deleted from the mailbox after each retrieval.
• In the keep mode, the mail remains in the mailbox after retrieval. The delete mode is
normally used when the user is working at her permanent computer and can save and
organize the received mail after reading or replying.
• The keep mode is normally used when the user accesses her mail away from her primary
computer. The mail is read but kept in the system for later retrieval and organizing.
MIME Headers
MIME defines five headers, which can be added to the original e-mail header section to define
the transformation parameters.
MIME-Version:
This header defines the version of MIME used. The current version is 1.1
Content-Type:
This header defines the type of data used in the body of the message. The content type and the
content subtype are separated by a slash. Depending on the subtype, the header may contain
other parameters. MIME allows seven different types of data.
Content-Transfer-Encoding:
This header defines the method used to encode the messages into 0s and 1s for transport. The
five types of encoding methods are listed below.
In the Base64 encoding, data, as a string of bits, is first divided into 6-bit chunks.
Base64 Conversion
Each 6-bit section is then converted into an ASCII character according to below table:
Web-Based Mail
E-mail is such a common application that some websites today provide this service to anyone
who accesses the site. Three common sites are Hotmail, Yahoo, and Google mail.
Case I:
• In the first case, Alice, the sender, uses a traditional mail server; Bob, the receiver, has
an account on a web-based server.
• Mail transfer from Alice’s browser to her mail server is done through SMTP. The
transfer of the message from the sending mail server to the receiving mail server is still
through SMTP.
• However, the message from the receiving server (the web server) to Bob’s browser is
done through HTTP.
Case II:
• In the second case, both Alice and Bob use web servers, but not necessarily the same
server.
• Alice sends the message to the web server using HTTP transactions.
• The server at the Alice site passes the message to the SMTP client and sends it to the
server at the Bob site using SMTP protocol.
• Bob receives the message using HTTP transactions. However, the message from the
server at the Alice site to the server at the Bob site still takes place using SMTP protocol.
E-Mail Security
The e-mail protocol does not provide any security provisions. However, e-mail exchanges can
be secured using two application-layer securities. They are, Pretty Good Privacy (PGP) and
Secure/Multipurpose Internet Mail Extensions (S/MIME).
TELNET
TELNET is a remote logging protocol, which is an abbreviation for TErminaL NETwork.
Although TELNET requires a logging name and password, it is vulnerable to hacking because
it sends all data including the password in plaintext (not encrypted). This limitation is resolved
in another protocol, Secure Shell (SSH).
1. The simple plaintext architecture of TELNET allows us to understand the issues and
challenges related to the concept of remote logging.
2. Network administrators often use TELNET for diagnostic and debugging purposes.
• For data, NVT normally uses the NVT ASCII. This is an 8-bit character set in which
the seven lowest order bits are the same as US ASCII and the highest order bit is 0.
• To send control characters from client to server or vice versa, NVT uses an 8-bit
character set in which the highest order bit is set to 1.
Options
TELNET lets the client and server negotiate options before or during the use of the service.
Options are extra features available to a user with a more sophisticated terminal. Users with
simpler terminals can use default features.
User Interface
The operating system defines an interface with user-friendly commands. Examples of interface
commands:
Components
SSH is an application-layer protocol with three components, as shown in below figure.
Applications
SSH is a general-purpose protocol that provides a secure connection between a client and
server.
SSH for Remote Logging
Several free and commercial applications use SSH for remote logging. For example, PuTTy,
by Simon Tatham, which is a client SSH program that can be used for remote logging. Another
application program is Tectia, which can be used on several platforms.
Port Forwarding
• With port forwarding, we can use the secured channels available in SSH to access an
application program that does not provide security services.
• The SSH port forwarding mechanism creates a tunnel through which the messages
belonging to other protocols can travel.
• This mechanism is referred to as SSH tunneling. Below figure shows the concept of
port forwarding for securing the FTP application.
Label
Each node in the tree has a label, which is a string with a maximum of 63 characters. The root
label is a null string (empty string). DNS requires that children of a node have different labels,
which guarantees the uniqueness of the domain names.
Domain Name
• Each node in the tree has a domain name. A full domain name is a sequence of labels
separated by dots (.). The domain names are always read from the node up to the root.
• The last label is the label of the root (null). This means that a full domain name always
ends in a null label, which means the last character is a dot because the null string is
nothing.
• If a label is terminated by a null string, it is called a fully qualified domain name
(FQDN). If a label is not terminated by a null string, it is called a partially qualified
domain name (PQDN).
• A PQDN starts from a node, but it does not reach the root. It is used when the name to
be resolved belongs to the same site as the client. Here the resolver can supply the
missing part, called the suffix, to create an FQDN.
Domain
A domain is a subtree of the domain name space. The name of the domain is the name of the
node at the top of the subtree. Below figure shows some domains. Note that a domain may
itself be divided into domains.
Distribution of Name Space
• The information contained in the domain name space must be stored. However, it is
very inefficient and also not reliable to have just one computer store such a huge amount
of information.
• It is inefficient because responding to requests from all over the world places a heavy
load on the system. It is not reliable because any failure makes the data inaccessible.
Zone
• Since the complete domain name hierarchy cannot be stored on a single server, it is
divided among many servers.
• What a server is responsible for or has authority over is called a zone.
• If a server accepts responsibility for a domain and does not divide the domain into
smaller domains, the “domain” and the “zone” refer to the same.
• The server makes a data base called a zone file and keeps all the information for every
node under that domain.
• However, if a server divides its domain into subdomains and delegates part of its
authority to other servers, “domain” and “zone” refer to different things.
• The information about the nodes in the subdomains is stored in the servers at the lower
levels.
Root Server
• A root server is a server whose zone consists of the whole tree. A root server usually
does not store any information about domains but delegates its authority to other
servers, keeping references to those servers.
• There are several root servers, each covering the whole domain name space. The root
servers are distributed all around the world.
The first level in the generic domains section allows 14 possible labels. These labels describe
the organization types.
Country Domains
• The country domains section uses two-character country abbreviations (e.g., us for
United States).
• Second labels can be organizational, or they can be more specific national designations.
• The United States, for example, uses state abbreviations as a sub division of us (e.g.,
ca.us.).
• The address uci.ca.us. can be translated to University of California, Irvine, in the state
of California in the United States.
Resolution
• Mapping a name to an address is called name-address resolution. DNS is designed as a
client-server application.
• A host that needs to map an address to a name or a name to an address calls a DNS
client called a resolver. The resolver accesses the closest DNS server with a mapping
request.
• If the server has the information, it satisfies the resolver; otherwise, it either refers the
resolver to other servers or asks other servers to provide the information.
• A resolution can be either recursive or iterative.
Recursive Resolution
Assume that an application program running on a host named some.anet.com needs to find the
IP address of another host named engineering.mcgraw-hill.com to send a message to. The
source host is connected to the Anet ISP; the destination host is connected to the McGraw-Hill
network.
• The application program on the source host calls the DNS resolver (client) to find the
IP address of the destination host.
• The resolver, which does not know this address, sends the query to the local DNS server
(for example, dns.anet.com) running at the Anet ISP site (event 1).
• We assume that this server does not know the IP address of the destination host either.
It sends the query to a root DNS server(event 2).
• Root servers do not normally keep the mapping between names and IP addresses, the
query is sent to this top-level-domain server (event 3).
• We assume that this server does not know the name-address mapping of this specific
destination, but it knows the IP address of the local DNS server in the McGraw-Hill
company (for example, dns.mcgraw-hill.com).
• The query is sent to this server (event 4), which knows the IP address of the destination
host.
• The IP address is now sent back to the top-level DNS server (event 5), then back to the
root server (event 6), then back to the ISP DNS server, which may cache it for the future
queries (event 7), and finally back to the source host (event 8).
Iterative Resolution
• In iterative resolution, each server that does not know the mapping sends the IP address
of the next server back to the one that requested it.
• Normally the iterative resolution takes place between two local servers; the original
resolver gets the final answer from the local server.
• Messages shown by events 2, 4, and 6 contain the same query. However, the message
shown by event 3 contains the IP address of the top-level domain server, the message
shown by event 5 contains the IP address of the McGraw-Hill local DNS server, and
the message shown by event 7 contains the IP address of the destination.
• When the Anet local DNS server receives the IP address of the destination, it sends it
to the resolver (event 8).
Caching
• When a server asks for a mapping from another server and receives the response, it
stores this information in its cache memory before sending it to the client.
• If the same or another client asks for the same mapping, it can check its cache memory
and resolve the problem.
• However, to inform the client that the response is coming from the cache memory and
not from an authoritative source, the server marks the response as unauthoritative.
• Caching speeds up resolution, but it can also be problematic. If a server caches a
mapping for a long time, it may send an outdated mapping to the client.
• To counter this, two techniques are used. First, the authoritative server always adds
information to the mapping called time to live (TTL). It defines the time in seconds that
the receiving server can cache the information.
• After that time, the mapping is invalid and any query must be sent again to the
authoritative server.
• Second, DNS requires that each server keep a TTL counter for each mapping it caches.
The cache memory must be searched periodically and those mappings with an expired
TTL must be purged.
Resource Records
The zone information associated with a server is implemented as a set of resource records. In
other words, a name server stores a database of resource records. A resource record is a 5-tuple
structure, as shown below:
(Domain Name, Type, Class, TTL, Value)
• The domain name field is what identifies the resource record. The value defines the
information kept about the domain name.
• The TTL defines the number of seconds for which the information is valid.
• The class defines the type of network. The type defines how the value should be
interpreted. Below table lists the common types and how the value is interpreted for
each type.
DNS Messages
To retrieve information about hosts, DNS uses two types of messages: query and response.
Both types have the same format as shown below.
• The identification field is used by the client to match the response with the query. The
flag field defines whether the message is a query or response. It also includes status of
error.
• The next four fields in the header define the number of each record type in the message.
The question section consists of one or more question records. It is present in both query
and response messages.
• The answer section consists of one or more resource records. It is present only in
response messages. The authoritative section gives information (domain name) about
one or more authoritative servers for the query.
• The additional information section provides additional information that may help the
resolver.
Encapsulation
DNS can use either UDP or TCP. In both cases the well-known port used by the server is port
53. UDP is used when the size of the response message is less than 512 bytes because most
UDP packages have a 512-byte packet size limit.
If the size of the response message is more than 512 bytes, a TCP connection is used. In that
case, one of two scenarios can occur:
1. If the resolver has prior knowledge that the size of the response message is more than
512 bytes, it uses the TCP connection. For example, if a secondary name server (acting
as a client) needs a zone transfer from a primary server, it uses the TCP connection
because the size of the information being transferred usually exceeds 512 bytes.
2. If the resolver does not know the size of the response message, it can use the UDP port.
However, if the size of the response message is more than 512 bytes, the server truncates
the message and turns on the TC bit. The resolver now opens a TCP connection and
repeats the request to get a full response from the server.
Registrars
New domains added to DNS through a registrar, a commercial entity accredited by ICANN. A
registrar first verifies that the requested domain name is unique and then enters it into the DNS
database. A fee is charged. Today, there are many registrars; their names and addresses can be
found at
http://www.intenic.net
To register, the organization needs to give the name of its server and the IP address of the server.
DDNS
• In DNS, when there is a change, such as adding a new host, removing a host, or
changing an IP address, the change must be made to the DNS master file.
• These types of changes involve a lot of manual updating. The size of today’s Internet
does not allow for this kind of manual operation.
• The DNS master file must be updated dynamically.
• The Dynamic Domain Name System (DDNS) therefore was devised to respond to this
need. The information is sent, usually by DHCP to a primary DNS server. The primary
server updates the zone.
• The secondary servers are notified either actively or passively. In active notification,
the primary server sends a message to the secondary servers about the change in the
zone, whereas in passive notification, the secondary servers periodically check for any
changes.
• In either case, after being notified about the change, the secondary server requests
information about the entire zone (called the zone transfer).
• To provide security and prevent unauthorized changes in the DNS records, DDNS can
use an authentication mechanism.
Security of DNS
Applications such as Web access or e-mail are heavily dependent on the proper operation of
DNS. DNS can be attacked in several ways including:
1. The attacker may read the response of a DNS server to find the nature or names of sites
the user mostly accesses. This type of information can be used to find the user’s profile.
To prevent this attack, DNS messages need to be confidential.
2. The attacker may intercept the response of a DNS server and change it or create a totally
new bogus response to direct the user to the site or domain the attacker wishes the user
to access. This type of attack can be prevented using message origin authentication and
message integrity.
3. The attacker may flood the DNS server to overwhelm it or eventually crash it. This type
of attack can be prevented using the provision against denial-of-service attack.
To protect DNS, IETF has devised a technology named DNS Security (DNSSEC) that provides
message origin authentication and message integrity using a security service called digital
signature. DNSSEC, however, does not provide confidentiality for the DNS messages. There
is no specific protection against the denial-of service attack in the specification of DNSSEC.
However, the caching system protects the upper-level servers against this attack to some extent.