17. Email and DNS

Email

Three major components:

Simple Mail Transfer Protocol (SMTP)

The standard protocol used to transfer email between servers.

Basic operation:

SMTP uses telenet connection and runs on port 25 by default.

Sample telenet interaction:

Mail message format:

From: user@client_host_name
To: user@server_host_name
Subject: subject_text
[BLANK LINE]
message_body

The receiving server appends a Received: header line to the top of the message as a record of the mail servers the email passed through.

Multipurpose Internet Mail Extension (MIME)

For non-ASCII data, MIME is used. It specifies the type of content (e.g. jpeg, mp3) and the method in which it is encoded. For example:

...
Subject: subject_text
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Type: image/jpeg
[BLANK LINE]
base64_encoded data

In base64 encoding, every three octets (24 bits) are divided into four bytes of 6 bits each - enough to fit into an ASCII character. The characters A-Za-z0-9+/ is used, with A corresponding to 0 and / to 63. = is used as padding.

SMTP and Mail Access Protocols

Access protocols are used for communication between the receiver’s mail server and user agent. Two mail protocols are:

Web-based email is another alternative; the user agent uses HTTP to communicate with its remote mailbox.

POP3

TCP telenet connection running on port 110.

During the authorization phase, the client sends two commands:

After each command is sent, the server responds with either +OK or -ERR.

During the transaction phase, the client can send:

IMAP

IMAP:

Domain Name System (DNS)

DNS is:

Some DNS services:

DNS is not centralized:

Hierarchy

DNS is composted of three main levels of DNS servers:

If a client wants the IP address for www.google.com, to a first approximation, it will:

There are 13 root name servers worldwide (although each is a cluster of replicated servers).

Local name servers do not belong to the hierarchy, but are central to the DNS architecture. Each ISP has provides one and acts as the default name server.

Query Types and Caching

If a client wants the IP address for www.google.com through an iterated query:

A recursive query puts the burden of name resolution to the contacted name server:

Both queries require 8 messages. Hence, caching is used:

Hence, root name servers are usually not consulted.

DNS records

Each resource record stores the name, value, type, ttl and class (although that is always IN (internet)).

Some types values:

DNS Messages

Both query and rely messages use the same message format:

|       16 bits      |       16 bits       |
|   Identification   |       Flags         |
|   Num. questions   |   Num. answer RPs   |
| Num. authority RPs | Num. additional RPs |
|        Questions (variable num.)         |
|       Answers (variable num. RRs)        |
|      Authority (variable num. RRs)       |
|    Additional info (variable num. RRs)   |

The query and reply to the corresponding query have the same identification number.

The flags indicate;

The additional fields:

Adding New Records

Example: registering a domain name at a registrar: