New CCN - Chapter 6 - R2019
New CCN - Chapter 6 - R2019
New CCN - Chapter 6 - R2019
- Jyoti Bagate
Hypertext Transfer Protocol (HTTP)
HTTP
◻ The Hypertext Transfer Protocol (HTTP) is a protocol used mainly to access data on
the World Wide Web. HTTP functions like a combination of FTP and SMTP.
◻ It is similar to FTP because it transfers files and uses the services of TCP.
◻ However, it is much simpler than FTP because it uses only one TCP connection. There is
no separate control connection; only data are transferred between the client and the server.
◻ HTTP is like SMTP because the data transferred between the client and the server look
like SMTP messages. In addition, the format of the messages is controlled by MIME-like
headers. Unlike SMTP, the HTTP messages are not destined to be read by humans; they
are read and interpreted by the HTTP server and HTTP client (browser).
◻ SMTP messages are stored and forwarded, but HTTP messages are delivered immediately.
◻ The commands from the client to the server are embedded in a request message.
◻ The contents of the requested file or other information are embedded in a response
message. HTTP uses the services of TCP on well-known port 80.
◻ HTTP uses the services of TCP on well-known port 80.
HTTP Transaction
◻ Figure illustrates the HTTP transaction between the client and server.
◻ Although HTTP uses the services of TCP, HTTP itself is a stateless protocol, which means that the
server does not keep information about the client.
◻ The client initializes the transaction by sending a request. The server replie by sending a response
◻ Request Message
◻ The format of the request is shown in Figure 22.11. A request message consists of a request line, a
header, and sometimes a body.
◻ Request Line
◻ The first line in a request message is called a request line.
◻ There are three fields in this line separated by some character delimiter as shown in Figure
◻ The fields are called methods, URL, and Version. These three should be separated by a space
character. At the end two characters, a carriage return followed by a line feed terminate the line.
The method field defines the request type. In version 1.1 of HTTP, several methods are defined, as
shown in Table .
HTTP Transaction
Format of Request Message
◻ Header Lines In Request Message 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.
◻ For example, the client can request that the document be sent in a special
format. Each header line has a header name, a colon, a space, and a header
value (see Figure).
◻ We will show some header lines in the examples at the end of this chapter.
Table (next) shows some header names commonly used in a request.
◻ The value field defines the values associated with each header name.
◻ The list of values can be found in the corresponding RFCs.
Request Header Names
• Each header line has a header name, a colon, a space, and a header value.
• Next Table shows some header names commonly used in a response message.
• Body:
• The body contains the document to be sent from the server to the client.
• The body is present unless the response is an error message.
Response Message
Example 1
Solution:
We use the GET method to retrieve an image with the path /usr/bin/image1.
The request line shows the method (GET), the URL, and the HTTP version
(1.1). The header has two lines that show that the client can accept images in
the GIF or JPEG format. The request does not have a body. The response
message contains the status line and four lines of header. The header lines
define the date, server, MIME version, and length of the document. The body
of the document follows the header.
Example 1
Example 2
◻ In this example, the client wants to send data to the server. We use the POST
method.
◻ The request line shows the method (POST), URL, and HTTP version (1.1).
There are four lines of headers.
◻ The request body contains the input information. The response message
contains the status line and four lines of headers.
◻ The created document, which is a CGI document, is included as the body (see
Figure 22.14).
Example 2
Hypertext Transfer Protocol (HTTP)
⮚ The Hypertext Hypertext Transfer Protocol (HTTP) is a protocol protocol used mainly
to access data on the World Wide Web.
⮚ HTTP functions as a combination of FTP and SMTP
⮚ HTTP uses the services of TCP on well-known port 80.
Request and Response Message
Header Format
File Transfer Protocol (FTP)
File Transfer Protocol (FTP)
•FTP stands for File transfer protocol.
•FTP is a standard internet protocol provided by TCP/IP used for transmitting
the files from one host to another.
•It is mainly used for transferring the web page files from their creator to the
computer that acts as a server for other computers on the internet.
•It is also used for downloading the files to computer from other servers.
Objectives of FTP
•It provides the sharing of files.
•It is used to encourage the use of remote computers.
•It transfers the data more reliably and efficiently.
WHY FTP?
❖ Although transferring files from one system to another is very simple and straightforward, but sometimes it can cause problems.
For example, two systems may have different file conventions. Two systems may have different ways to represent text and data.
Two systems may have different directory structures. FTP protocol overcomes these problems by establishing two connections
between hosts. One connection is used for data transfer, and another connection is used for the control connection.
FTP Mechanism
✔ Figure shows the basic model of the FTP.
✔ The FTP client has three components: the user
interface, control process, and data transfer process.
✔ The server has two components: the server control
process and the server data transfer process.
Two types of Connections in FTP
•Control Connection: The control connection uses very simple rules for communication.
Through control connection, we can transfer a line of command or line of response at a
time. The control connection is made between the control processes. The control
connection remains connected during the entire interactive FTP session.
•Data Connection: The Data Connection uses very complex rules as data types may vary.
The data connection is made between data transfer processes. The data connection opens
when a command comes for transferring the files and closes when the file is transferred.
FTP Client
•FTP client is a program that implements a file transfer protocol which allows
you to transfer files between two hosts on the internet.
•It allows a user to connect to a remote host and upload or download the files.
•It has a set of commands that we can use to connect to a host, transfer the
files between you and your host and close the connection.
•The FTP program is also available as a built-in component in a Web browser.
This GUI based FTP client makes the file transfer very easy and also does not
require to remember the FTP commands.
Advantages of FTP:
•Speed: One of the biggest advantages of FTP is speed. The FTP is one of the fastest way to transfer the files
from one computer to another computer.
•Efficient: It is more efficient as we do not need to complete all the operations to get the entire file.
•Security: To access the FTP server, we need to login with the username and password. Therefore, we can say
that FTP is more secure.
•Back & forth movement: FTP allows us to transfer the files back and forth. Suppose you are a manager of the
company, you send some information to all the employees, and they all send information back on the same
server.
Disadvantages of FTP:
•The standard requirement of the industry is that all the FTP transmissions should be encrypted. However, not all
the FTP providers are equal and not all the providers offer encryption. So, we will have to look out for the FTP
providers that provides encryption.
•FTP serves two operations, i.e., to send and receive large files on a network. However, the size limit of the file is
2GB that can be sent. It also doesn't allow you to run simultaneous transfers to multiple receivers.
•Passwords and file contents are sent in clear text that allows unwanted eavesdropping. So, it is quite possible
that attackers can carry out the brute force attack by trying to guess the FTP password.
•It is not compatible with every system.
Domain Name Server (DNS)
Introduction
⮚DNS is the second application program.
⮚DNS is a client/server application program used to help other
application programs.
⮚DNS is used to map a host name in the application layer to an IP
address in the network layer.
Need for DNS
⮚TCP/IP protocol use the IP address, which uniquely identifies the connection of a host to the
internet.
⮚People refer to use names instead of numeric addresses. Therefore we need a system that can map
to an address or an address to a name.
⮚When internet was small mapping was done using a host file which had two columns: name and
address.
⮚For large internet, options are:
1. One option is to store entire host file in a single computer and allow access to this centralized
information to every computer that needs mapping.
2. Other option is to divide this huge amount of information into smaller parts and store each
part on a different computer. The host that needs mapping can contact the closest computer
holding the needed information. This method is used by Domain Name System (DNS).
Purpose of DNS
⮚ Figure shows how TCP/IP uses a DNS client and DNS server to map a name to an address; the reverse mapping is
similar.
⮚ in Figure, a user wants to use a file transfer client to access the corresponding file transfer server running on a remote
host.
⮚The user knows only the file transfer server name, such as forouzan.com.
⮚However TCP/IP suits needs the IP address of the file transfer server to make the connection.
Purpose of DNS
The following six steps map the host name to an IP Address.
1. The user passes the host name to the file transfer client.
2. The file transfer client passes the host name to the DNS client.
3. Each computer, after being booted, knows the address of one DNS server.
The DNS client sends a message to a DNS server with a query that gives the
file transfer server name using the known IP address of the DNS server.
4. The DNS server responds with the IP address of the desired file transfer
server.
5. The DNS client passes the IP address to the file transfer server.
6. The file transfer client now uses the received IP address to access the file
transfer server.
Name space
⮚The name assigned to machines must be carefully selected from a name space
with complete control over the binding between the name and IP addresses.
⮚The name must be unique because the addresses are unique.
⮚A name space that maps each address to a unique name can be organized in
two groups.
1. Flat Name space
2. Hierarchical Name Space
Flat Name Space
⮚In a flat name space, a name is assigned to an address.
⮚A name in this space is sequence of characters without structure.
⮚The names may or may not have a common sections: if they do, it has
no meaning.
⮚Advantage: it cannot be used in a large system such as the internet
because it must be centrally controlled to avoid ambiguity and
duplication.
Hierarchical Name Space
⮚In a hierarchical Name space, each name is made of several parts.
⮚The first part can define the nature of the organization
⮚The second part can define the name of the organization
⮚The third part can define departments in the organization and so on.
⮚In this case, the authority to assign and control the name spaces can be decentralized.
⮚A central authority can assign the part of the name that defines the nature of the
organization and name of the organization.
⮚The responsibility of the rest of the name can be given to the organization itself.
⮚The organization can add suffixes (or prefixes) to the name to define its host or
resources.
⮚The management of the organization need not worry that the prefix chosen for a host
is taken by another organization because even if part of an address is same, the whole
address is different.
Domain Name space
⮚To have a hierarchical name space, a domain name space was designed.
⮚In this design, the names are defined in an inverted –tree structure with the root at the
top.
⮚The tree can have only 128 levels: level 0(root) to level 127
Domain Name space
⮚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 ( nodes that branch from the same 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 of the root (null).
✔ means a full domain always ends in a
null label, which means the last
character is a dot because the null string
is nothing.
Fully qualified domain name
⮚If a label is terminated by a null string, it is called fully qualified domain name
(FQDN).
⮚An FQDN is a domain name that contains the full name of a host.
⮚It contains all labels, from the most specific to the most general, that uniquely define the
name of the host.
⮚E.g the domain name is the FQDN of a computer named challenger installed at the Advanced
Technology Center (ATC) at De Anza college.
⮚A DNS server can only match an FQDN to an address.
⮚The name must end with a null label, but because null means nothing, the label ends with a
dot (.) challenger.atc.fhda.edu.
Partially qualified domain name (PQDN)
⮚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.
⮚E.g if a user at the fhda.edu. site wants to get the IP address of the challenger computer, he
or she can define the partial name challenger
⮚The DNS client adds the suffix stc.fhda.edu. before passing the address to the DNS server.
⮚The DNS client normally holds a list of suffixes. The following can be the list of suffixes
at De Anza College.
⮚The null suffix defines nothing. This suffix is added when the user defines an FQDN.
atc.fhda.edu fhda.edu null
Domain
⮚A domain is a structure of the
domain name space.
⮚The name of the domain is the
name of the node at the top of the
subtree.
⮚Next figure shows some domains.
⮚Domain may itself be divided into
domains (or subdomains as they
are sometimes called.)
Distribution of Name space
⮚The information contained in the domain name space must be stored.
⮚It is very inefficient and also not reliable to have just one computer store such
a huge amount of information.
⮚It is inefficient responding to requests from all over the world places a heavy
load on the systems.
⮚It is not reliable because any failure makes the data inaccessible.
Hierarchy of Name server
⮚ The solution to these problems is to distribute the information among many computers called DNS servers.
⮚ One way to do this is to divide the whole space into many domains based on the first level.
⮚ We let the root stand alone an create as many domains (subtrees) as there are first level nodes.
⮚ Because a domain created this way could be very large. DND allows domains to be divided further into
smaller domains (subdomains).
⮚ Each server can be responsible (authoritative) for either a large or small domain.
⮚ We have a hierarchy of servers in the same way that we have a hierarchy of names.
Zone ⮚ What a server is responsible for or has authority
over is called a ZONE. Zone is a contiguous part of
the entire tree.
⮚ If a server accepts responsibility for a domain and
does not divide the domain into smaller domains, the
“domains” and “zone” refers to the same thing.
⮚ The server makes the database called a “zone file” and
keeps all the information for every node under that
domain.
⮚ If the 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, with the
original server keeping some sort of reference to these
⮚Original server still has a zone, but the detailed information is kept
lower-level by the lower level servers.
servers.
⮚A server can also divide part of its domain and delegate responsibility but still keeps part of the domain for
itself.
⮚In this case, its zone is made of detailed information for the part of the domain that is not delegated and
references to those parts that are delegated.
Root server
⮚A root server is a server whose zone consists of whole tree.
⮚A root server usually does not store any information about domains but delegates
its authority to other services, keeping reference to those servers.
⮚There are several root servers, each covering the whole domain name space.
⮚The root servers are distributed all around the world.
⮚A secondary server is a server that transfers the complete information about a zone
from another server (primary or secondary) and stores the file on its local disk.
⮚The secondary server neither creates nor updates the zone files.
⮚If updating is required it must be done by the primary server, which sends the
updated version to the secondary.
⮚The primary and secondary servers are both authorities for the zones they serve.
⮚The idea is not to put the secondary server at a lower level of authority but to create
redundancy for the data so that if one server fails, the other can continue serving
clients.
⮚A server can be a primary server for a specific zone and a secondary server for
another zone.
⮚When we refer to a server as a primary or secondary server, we should be careful
about which zone we refer to.
Note:
SMTP Range
• Commands and Responses:
⮚SMTP uses commands and responses to transfer messages between MTA client and an
MTA server.
⮚Each command or reply is terminated by a two character (carriage return and line feed)
end-of-line.
Commands:
⮚ Commands are sent from the client to the server.
⮚ Format is keyword: argument(s)
⮚ It consists of a keyword followed by zero or more arguments.
⮚ SMTP defines 14 commands listed in below table.
Commands:
⮚ HELO: is used by client to identify itself.
The argument is the domain name of the
client host. The format is
HELO:challenger.atc.fhda.edu
⮚ MAIL FROM: is used by client to identify
sender of the message. The argument is the
email address of the sender (local part plus
the domain name).The format is:
MAIL FROM:
[email protected]
⮚ RCPT TO: is used by the client to
identify the intended recipient of the
message. The argument is the email address
of the recipient. If there are multiple
recipients, the command is repeated. The
format is:
RCPT TO: betsy@ megraw-hill.com
⮚ DATA: is used to send the actual message. All lines that follows the data command treated as the
email message. The message is terminated by a line containing just one period. The format is:
DATA This is the message To be send to the McGraw –Hill Company.
⮚ QUIT: this command terminates the message. The format is QUIT
• RESET: this command aborts the current mail transaction. The stored information about the sender
and recipient is deleted. The connection will be reset. The format is: RESET
⮚ VEFY: is used to verify the address of the recipient, which is sent as the argument. The sender can ask
the receiver to confirm that a name identifies a valid recipient. Its format is: VEFY:
[email protected]
⮚ NOOP: is used by the client to check the status of the recipient. It requires an answer from the
recipient. Format: NOOP
⮚ TURN: This command lets the sender and recipient switch positions, whereby the sender becomes the
recipient and vice versa. Most SMTP implementations today do not support this feature. The format
is : TURN
⮚ EXPN: This command asks the receiving host to expand the mailing list sent as the arguments and to
return the mailbox addresses of the recipients that comprise the list. The format is: EXPN: x y z
⮚HELP: this command asks the recipient to send the information about the command
sent as the argument. The format is HELP: mail
⮚SEND FORM: this commands specifies that the mail is to be delivered to the
terminal of the recipient and not the mailbox. If the recipient is not logged in, the
mail is bounced back. The argument is the address of the sender .
The format is SEND FORM : [email protected]
⮚SMOL FROM: This command specifies that the mail is to be delivered to the
terminal or the mailbox of the recipient. This means that if the recipient is logged in,
the mail is delivered only to the terminal. If the recipient is not logged in, the mail is
delivered to the mailbox. The argument is the address of the sender.
The format is: SMOL FROM: [email protected]
⮚SMAL FROM: This command specifies that the mail is to be delivered to the
terminal or the mailbox of the recipient. This means that if the recipient is logged in,
the mail is delivered to the terminal and mailbox. If the recipient is not logged in, the
mail is delivered only to the mailbox. The argument is the address of the sender.
The format is: SMOL FROM: [email protected]
• Responses:
✔ Responses are sent from
the server to the client.
✔ A response is a three
digit code that may be
followed by additional
textual information.
✔ Next table gives lists of
the responses.
Table 20.5 Responses (Continued)
• Mail Transfer Phases:
✔ The process of transferring a mail message occurs in three phases: connection
establishment, mail transfer and connection termination.
⮚Connection establishment:
✔ After a client has made a TCP connection to the well known port 25, the SMTP
server starts the connection phase.
✔ This phase involves following three steps as shown in figure:
⮚Phase 1: Connection establishment:
1) The server sends code 220 (service ready) to tell the client that it is
ready to receive mail. If the server is not ready, it sends code 421
(service not available).
2) The client send 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. During TCP connection establishment, the sender
and receiver know each other through their IP address.
3) The server responds with code 250 (request command completed) or
some other code depending on the situation.
• Phase 2: Message
Transfer:
⮚After connection has
been established between
the SMTP client and
server, a single message
between a sender and one
or more recipients can be
exchanged. This phase
involves 8 steps. Steps 3
and 4 are repeated if there
is more that one recipient.
• Phase 2: Message Transfer: 8 steps:
1. The client sends the MAIL FROM message to introduce the sender of the message. It
includes the mail address of the sender (mailbox and domain name). This step is needs
to give the server the return mail address for returning errors and reporting messages.
2. The server responds with the code 250 or some other appropriate code.
3. The client sends the RCPT TO (recipient) message, which includes the mail address of
the recipient.
4. The server responds with the code 250 or some other appropriate code.
5. The client sends the DATA message to initialize the message transfer.
6. The server responds with code 354 (start mail input) or some other appropriate
message.
7. The client sends the contents of the message in consecutive lines. Each line is
terminated by a two character end of line token (carriage return and line feed). The
message is terminated by a line containing just one period.
8. The server responds with code 250 (OK) or some other appropriate code.
• Phase 3: Connection Termination
✔ After the message is transferred successfully, the client terminates the connection.
✔ This phase involves two steps.
1. The client sends the QUIT command.
2. The server responds with code 221 or some other appropriate code.
After the connection termination phase, the TCP connection must be closed.
Example 1
Let us see how we can directly use SMTP to send an email and simulate the
commands and responses we described in this section. We use TELNET to log into
port 25 (the well-known port for SMTP). We then use the commands directly to send
an email. In this example, [email protected] is sending an email to himself. The
first few lines show TELNET trying to connect to the adelphia mail server.
$ telnet mail.adelphia.net 25
Trying 68.168.78.100...
Connected to mail.adelphia.net (68.168.78.100).
After connection, we can type the SMTP commands and then receive the responses as
shown below. We have shown the commands in black and the responses in color. Note
that we have added for clarification some comment lines, designated by the “=” sign.
These lines are not part of the email procedure.
TCP/IP Protocol Suite
78
Example 1 (Continued)
================== Connection Establishment ============
220 mta13.adelphia.net SMTP server ready Fri, 6 Aug 2004 . . .
HELO mail.adelphia.net
250 mta13.adelphia.net
===================== Envelope ===================
MAIL FROM: [email protected]
250 Sender <[email protected]> Ok
RCPT TO: [email protected]
250 Recipient <[email protected]> Ok
=================== Header and Body ==================
DATA
354 Ok Send data ending with <CRLF>.<CRLF>
From: Forouzan
TO: Forouzan
Cat file 1
Embedding
⮚ Cat is a unix command that displays the content of the file on the screen.
⮚ However the name of the file has been mistyped (filea instead of file 1). The user uses
backspace key to correct this situation.
Cat filea<backspace>1
⮚ However, in the default implementation of TELNET, the user cannot edit locally, the
editing is done at the remote server.
⮚ The backspace character is translated into two remote characters(IAC EC), which is
embedded in the data and sent to the remote server.
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.
Code Option Meaning
0 Binary Interpret as a8-bit binary transmission
1 Echo Echo the data received on one side to the
other
3 Suppress go- Suppress go-ahead signals after data
ahead
5 Status Request the status of TELNET
6 Timing mark Define the timing marks
24 Terminal type Set the terminal type
32 Terminal speed Set the terminal speed
34 Line mode Change to line mode
Option Negotiation
Some options can only be enabled by the server, some only by the client or some by both.
An option is enabled either through an offer or request.
1. Offer to enable:
⮚ A party can offer to enable an option if it has right to do so.
⮚ The offering can be approved or disapproved by the other party.
⮚ The offering party sends the WILL command, which means “Will I enable the
option?”. The other party sends either the DO command, which means “Please do,”
or the DON’T command, which means “Please don’t.”
2. Request to enable:-
⮚ A party can request from the other party the enabling of an option.
⮚ The request can be accepted or refused by the other party.
⮚ The requesting party sends the DO command, which means “Please do
enable the option.”
⮚ The other party sends either the WILL command, which means “I will.”
or the WONT command, which means “I won’t.”
Disabling an option
An option that has been enabled can be disabled by one of the parties. An option is
disabled either through an offer or a request.
1. Offer to disable:-
⮚ A party can offer to disable an option. The other party must approve the offering: it
cannot be disapproved.
⮚ The offering party sends the WONT command which means “I won’t use the option
any more.”
⮚ The answer must be the DONT command, which means “ Don’t use it anymore.”
2. Request to disable:-
⮚ A party can request from another party the disabling of an option.
⮚ The other party must accept the request; it cannot be rejected.
⮚ The requesting party sends the DON’T command, which means “Please
don’t use this option anymore.”
⮚ The answer must be the WONT command, which means “I won’t use it
anymore.
SECURE SHELL (SSH)
SECURE SHELL (SSH)
Anther popular remote login application program is SSH like TELNET, uses
TCP as the underlying transport protocol, but SSH is more secure and
provides more services than TELNET.
Versions:-
Two versions of SSH
1. SSH 1
2. SSH-2
which are totally incompatible. The first version SSH-1 is now
deprecated because of security flaws in it. So, only SSH-2 is discussed.
Components
Proposed application layer protocol with four components.
4. SSH applications:-
⮚ After the connection phase is completed, SSH allows several
application programs to use the connection.
⮚ Each application can create a logical channel and then benefit from
the secured connection.
⮚ Remote login is one of the services that can use the SSH-CONN
protocols; other applications such as a file transfer application can
use one of the logical channels for this purpose.
Format of SSH Packets
⮚ Length:-
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 field is used for error detection.
Dynamic Host Control Protocol
(DHCP)
Introduction
• Each computer that uses the TCP/IP protocol suite needs to know its IP address.
• If the computer uses classless addressing or is a member of a subnet, it also needs to know
its subnet mask.
• Four pieces of information are normally needed.
1. The IP address of the computer
2. The subnet mask of the computer
3. The IP address of a router
4. The IP address of a name server
Previous Protocols
• RARP: is a version of ARP
• ARP maps an IP address to a physical address; RARP maps a physical address to an IP address.
• RARP is deprecated today for two reasons:
1. RARP used the broadcast service of the data link layer, which means that a RARP server must be present
in each network.
2. RARP can provide only the IP address of the computer, but a computer today needs all four piece of
information
⮚ There is one problem that must be solved. The DHCP request is broadcast because the client does not know the IP address
of the server.
⮚A broadcast IP datagram cannot pass through any router. A router receiving such packets discards it. (recall that an IP
address of all 1s is a limited broadcast address.)
Operation of DHCP (on Different network)
• To Solve the problem, there is a need for an intermediary.
• One of the hosts (for a router that can be configured to operate at the application layer) can
be used as a relay. The host in this case is called a relay agent.
• The relay agent knows the unicast address of a DHCP server and listens for broadcast
message on port 67.
• When it receives this type of packet, it encapsulates the message in a unicast datagram and
sends the request to the DHCP server.
• The packet carrying a unicast destination address, is routed by any router and reaches the
DHCP server.
• The DHCP server knows the message comes from a relay agents because one of the fields in
the request message defines the IP address of a relay agent.
• The relay agent after receiving reply, sends it to the DHCP client.
UDP PORTS
• Next figure shows the interaction between a client and a DHCP server.
✔ The use of a well known port (less than 1024) prevents the use of the same two destination port numbers.
✔ Host B cannot select 68 as the ephemeral port because ephemeral port numbers are greater than 1023.
✔ If both host uses DHCP client, transaction ID is used to differentiate the clients.
✔ Transaction ID is randomly chosen for each connection involving DHCP.
✔ It is highly importable that two hosts will choose the same ID at the same time.
Error Control
• DHCP uses UDP which does not provide error control. Therefore DHCP must provide error
control.