The DNS and FTP Protocols
1. The DNS System
DNS Overview
DNS (Domain Name System) is a core service of the Internet, responsible for converting domain names into IP addresses.
The Hierarchical Name Space
The structure of a domain name:
- The root domain: the highest level, written as ”.”
- Top-level domains: country codes (such as .cn, .us) or organisation types (such as .com, .org)
- Second-level domains: the name of an organisation or institution
- Host names: the name of a particular host
Examples of domain names:
www.example.commail.google.comftp.microsoft.com
Name Servers
Root servers:
- There are 13 root server addresses worldwide
- They hold the information about the top-level domain servers
- They answer queries for the top-level domains
Top-level domain servers:
- They hold the information about the second-level domain servers
- They administer a particular top-level domain
- For example .com, .org, .cn
Authoritative servers:
- They hold the IP addresses of the particular domains
- They administer a particular domain
- They provide the final resolution result
Caching servers:
- They store the results of queries
- They reduce repeated queries
- They speed up resolution
The Name Resolution Process
Recursive query:
- The client queries the local DNS server
- The local DNS server queries a root server
- The root server returns the address of a top-level domain server
- The local DNS server queries the top-level domain server
- The top-level domain server returns the address of the authoritative server
- The local DNS server queries the authoritative server
- The authoritative server returns the IP address
- The local DNS server returns the result to the client
In a recursive query the local DNS server carries out the whole chain on the client’s behalf and hands back the final answer; the client makes a single request.
Iterative query:
- The client queries the local DNS server
- The local DNS server queries a root server
- The root server returns the address of a top-level domain server
- The local DNS server queries the top-level domain server
- The top-level domain server returns the address of the authoritative server
- The local DNS server queries the authoritative server
- The authoritative server returns the IP address
- The local DNS server returns the result to the client
In an iterative query each server returns a referral — the address of the next server to ask — and the local DNS server walks down the chain itself.
The DNS Protocol
Query types:
- A record: a domain mapped to an IPv4 address
- AAAA record: a domain mapped to an IPv6 address
- CNAME record: an alias for a domain
- MX record: the mail exchange record
- NS record: the name server record
Port number: 53 (UDP/TCP)
2. The FTP Protocol
FTP Overview
FTP (File Transfer Protocol) is the standard protocol used for file transfer.
How FTP Works
The two-connection model:
- The control connection: carries the commands and the responses
- The data connection: carries the file data
Establishing the connections:
- The client establishes a control connection to the server
- The server responds to the connection request
- The client sends its credentials
- The server verifies the user’s identity
- A data connection is established for the file transfer
The Control Connection
Functions:
- Carries the FTP commands
- Carries the server’s responses
- Manages the FTP session
Common commands:
USER: the user namePASS: the passwordLIST: list the filesRETR: download a fileSTOR: upload a fileQUIT: close the connection
Response codes:
200: the command succeeded220: the service is ready331: a user name is needed425: the data connection cannot be opened500: syntax error
The Data Connection
Functions:
- Carries the file data
- Carries the directory listings
- Carries the file information
Transfer modes:
- Active mode: the server connects to the client
- Passive mode: the client connects to the server
Data formats:
- ASCII mode: transfer of text files
- Binary mode: transfer of binary files
Characteristics of FTP
Advantages:
- High reliability: it runs over TCP, which guarantees reliable transfer
- Complete function set: it supports upload, download, deletion, and so on
- Broad compatibility: it runs on many operating systems
- Authentication: it supports user name and password authentication
Disadvantages:
- Weak security: the traffic is plaintext and easily eavesdropped
- Firewall problems: the two-connection model is easily restricted by firewalls
- Low efficiency: the protocol overhead is comparatively large
FTP Variants
SFTP:
- Secure FTP based on SSH
- The transfer is encrypted
- It uses a single connection
FTPS:
- FTP based on SSL/TLS
- The transfer is encrypted
- It keeps the original functions of FTP
3. DNS and FTP Applications
DNS Applications
Name resolution:
- Converts domain names into IP addresses
- Supports IPv4 and IPv6
- Provides load balancing
Mail routing:
- MX records designate the mail servers
- They support a priority order among mail servers
- They provide the mail routing service
Security services:
- DNSSEC provides authenticated verification
- It prevents DNS hijacking
- It keeps the resolution of a name secure
FTP Applications
File transfer:
- Uploading files to a server
- Downloading files from a server
- Deleting files on a server
File management:
- Listing the contents of a directory
- Creating and deleting directories
- Renaming files
Batch operations:
- Uploading many files at once
- Downloading many files at once
- Automated scripts
Exercise 1
What are the main steps in the DNS name resolution process?
Approach
Walk down the hierarchy in the order the queries travel — client, local server, root, top-level domain, authoritative server — and then describe the return path.
Steps
- Describe the client query.
- Describe the local DNS server lookup and its cache check.
- Describe the root server lookup.
- Describe the top-level domain server lookup.
- Describe the authoritative server lookup.
- Describe the return of the result.
Answer
The DNS name resolution process consists of the following main steps:
-
The client query:
- The client sends a query request to the local DNS server
- The query carries the domain name to be resolved
-
The local DNS server lookup:
- The local DNS server checks its cache
- If there is a cached result, it is returned directly
- If not, it queries a root server
-
The root server lookup:
- The local DNS server queries a root server
- The root server returns the addresses of the top-level domain servers
- For example the addresses of the .com and .org servers
-
The top-level domain server lookup:
- The local DNS server queries a top-level domain server
- It returns the address of the authoritative server
- For example the authoritative server for example.com
-
The authoritative server lookup:
- The local DNS server queries the authoritative server
- The authoritative server returns the final IP address
- The conversion from a domain name to an IP address is complete
-
The result is returned:
- The local DNS server returns the result to the client
- The client obtains the IP address of the target server
- A connection can now be established
Exercise 2
Why does FTP distinguish between the control connection and the data connection?
Approach
Explain the separation in terms of function first, then give the practical consequences: fewer connection setups, the ability to run several transfers at once, independent control over security, and recovery from a failure of either connection.
Steps
- Explain the separation of function.
- Explain the effect on efficiency.
- Explain the flexibility it allows.
- Explain the effect on security.
- Explain the effect on reliability.
- Explain the design rationale.
Answer
FTP distinguishes the control connection from the data connection for these reasons:
-
Separation of function:
- The control connection carries the commands and the responses
- The data connection carries the file data
- The responsibilities are clear and do not interfere with each other
-
Higher efficiency:
- The control connection stays open as a long-lived connection
- The data connection is established on demand
- The cost of establishing connections is reduced
-
Flexibility:
- Several file transfers can run at the same time
- Different transfer modes are supported
- It adapts to different network environments
-
Security:
- The control connection can be encrypted
- The data connection can be controlled independently
- Better security control is possible
-
Reliability:
- A failure of the control connection does not stop the data transfer
- A failed data connection can be re-established
- The overall reliability is improved
-
Protocol design:
- It follows the principle of layering
- It makes the protocol easier to extend
- It improves the maintainability of the protocol
| Term | Abbreviation | Explanation |
|---|---|---|
| Domain Name System | DNS | The name resolution system |
| Domain name | - | The hierarchical name of a host |
| Top-level domain | TLD | The highest level of a domain name |
| Root name server | - | The topmost level of the DNS hierarchy |
| Authoritative name server | - | The server that stores the records for a domain |
| Recursive query | - | One of the ways of querying DNS |
| Iterative query | - | One of the ways of querying DNS |
| Time to live | TTL | How long a DNS cache entry stays valid |
| File Transfer Protocol | FTP | The file transfer protocol |
| Control connection | - | The FTP command channel (port 21) |
| Data connection | - | The FTP data channel (port 20) |
| Active mode | PORT | The FTP active transfer mode |
| Passive mode | PASV | The FTP passive transfer mode |
| Anonymous FTP | - | FTP access that needs no authentication |
| Trivial File Transfer Protocol | TFTP | The simple file transfer protocol |
