0% found this document useful (0 votes)
6 views27 pages

Unit4 Application Layer DHCP FTP

The document discusses the Application Layer of the TCP/IP protocol suite, focusing on the Dynamic Host Configuration Protocol (DHCP) and the File Transfer Protocol (FTP). DHCP is responsible for providing essential network configuration information to devices, while FTP facilitates file transfers between clients and servers using two TCP connections. Key details about packet formats, operations, and command responses for both protocols are outlined.

Uploaded by

deeplemon52
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views27 pages

Unit4 Application Layer DHCP FTP

The document discusses the Application Layer of the TCP/IP protocol suite, focusing on the Dynamic Host Configuration Protocol (DHCP) and the File Transfer Protocol (FTP). DHCP is responsible for providing essential network configuration information to devices, while FTP facilitates file transfers between clients and servers using two TCP connections. Key details about packet formats, operations, and command responses for both protocols are outlined.

Uploaded by

deeplemon52
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Application Layer

Application Layer 2-1


Outline

 Dynamic Host Configuration Protocol (DHCP)


 File Transfer Protocol (FTP)

Application Layer 2-2


DHCP: Domain Host Configuration Protocol

Application Layer 2-3


INTRODUCTION

• Each computer that uses the TCP/IP protocol suite needs


to know its

• IP address.
• subnet and subnet mask.
• default router (gateway)
• name server (DNS)

• In other words, four pieces of information are normally


needed. DHCP is the entity which serves the purpose.

TCP/IP Protocol Suite


4
DHCP OPERATION

The DHCP client and server can either be on the


same network or on different networks.

Let us discuss each situation separately.

TCP/IP Protocol Suite


5
Figure Client and server on the same network

TCP/IP Protocol Suite


6
Figure Client and server on two different networks

TCP/IP Protocol Suite


7
Figure Use of UDP ports

DHCP uses UDP protocol

TCP/IP Protocol Suite


8
Figure DHCP packet format

TCP/IP Protocol Suite


9
DHCP packet format

1) Hop count: This is an 8 bit field defining the maximum number of


hops the packet can travel.

2) Operation code: This 8 bit field defines the type of DHCP packet
request (1) or reply (2)

3) Transaction Id: This is a 4 byte field carrying an integer. The


transaction identification is set by the client and is used to match a reply
with the request. The server returns the same value in its reply.

4) Number of seconds: This is a 16 bit field that indicated the number of


seconds elapsed since the time the client started to boot.

TCP/IP Protocol Suite


Introduction 1-10
DHCP packet format

5) Flag: This is a 16 bit field in which only the leftmost bit is used and the
rest of the bits should be set to Os. A left most bit specifies a forced
broadcast reply (instead of uncast) from the server. If the reply mere to
be unicast to the client, the destination IP address of the IP packet is the
address assigned to the client.

TCP/IP Protocol Suite


Introduction 1-11
DHCP packet format

6) Your IP address: This is a 4 byte field that contains the client IP


address. It is filled by the server (in the reply message) at the request of
the client.

7) Server IP address: This is a 4 byte field containing the server IP


address. It is filled by the server in a reply message.

8) Boot Filename: Optionally used by a client to request a particular type


of boot file in a DHCPDISCOVER message. Used by a server in
a DHCPOFFER to fully specify a boot file directory path and filename.

TCP/IP Protocol Suite


12
DHCP packet format

TCP/IP Protocol Suite


Introduction 1-13
TCP/IP Protocol Suite
14
DHCP CONFIGURATION

The DHCP has been devised to provide:

• static address allocation

• dynamic address allocation

TCP/IP Protocol Suite


15
Figure Option with tag 53

TCP/IP Protocol Suite


16
Figure DHCP client transition diagram

TCP/IP Protocol Suite


17
Figure Exchanging messages

TCP/IP Protocol Suite


18
FTP: File Transfer Protocol

Application Layer 2-19


FTP: the file transfer protocol
file transfer
FTP FTP FTP
user client server
interface
user
at host remote file
local file system
system

 transfer file to/from remote host


 client/server model
 client: side that initiates transfer (either to/from remote)
 server: remote host
 ftp: RFC 959

Application Layer 2-20


Note

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.
FTP: separate control, data connections

 FTP client contacts FTP server TCP control connection,


server port 21
at port 21, using TCP
 client authorized over control TCP data connection,
connection FTP server port 20 FTP
client server
 client browses remote
directory, sends commands
over control connection  server opens another TCP
data connection to transfer
 when server receives file another file
transfer command, server
opens 2nd TCP data  control connection: “out of
connection (for file) to client band”
 after transferring one file,  FTP server maintains
server closes data connection “state”: current directory,
earlier authentication

Application Layer 2-22


Figure FTP EXAMPLE

23
Figure Opening the control connection

24
Figure Creating the data connection

25
Figure Example

220 (Service ready) 1


2 USER forouzan
331 (User name OK. Password?) 3
4 PASS xxxxxx
230 (User login OK) 5

6 PORT 8888
150 (Data connection opens shortly) 7
8 LIST /usr/user/forouzan/reports
125 (Data connection OK) 9

List of files or directories 10


DATA
TRANSFER

List of files or directories 11

226 (Closing data connection) 12


13 QUIT
221 (Service closing) 14

TCP/IP Protocol Suite


26
FTP commands, responses
sample commands: sample return codes
1. USER username 1. 331 Username OK,
2. PASS password password required
3. LIST return list of file in 2. 125 data
current directory connection
already open;
4. RETR filename transfer starting
retrieves (gets) file 3. 425 Can’t open
5. STOR filename data connection
stores (puts) file onto 4. 452 Error writing
remote host file

Application Layer 2-27

You might also like