• No results found

Applications and Services. DNS (Domain Name System)

N/A
N/A
Protected

Academic year: 2021

Share "Applications and Services. DNS (Domain Name System)"

Copied!
9
0
0

Loading.... (view fulltext now)

Full text

(1)

Malathi Veeraraghavan 1

Applications and Services

l DNS (Domain Name Service)

l File Transfer Protocol (FTP)

l Simple Mail Transfer Protocol (SMTP)

DNS (Domain Name System)

l Distributed database used to:

• map between hostnames and IP addresses • provide electronic routing information

l Unix implementation: resolver (user-level process)

• gethostbyname: takes a domain name and returns an IP address • gethostbyaddr: takes an IP address and looks up a hostname

l DNS uses mainly UDP for its lookups

(2)

Malathi Veeraraghavan 3

Hierarchical organization of the DNS

n Each node has a label of up to 63 characters

n Root node has a null label

n Domain name of a node is the list of labels, starting at that node, working up to the root, using a period to separate the labels

n Network Information Center (NIC) maintains the top of the tree

n arpa is a special domain used for pointer queries to translate IP addresses into domain names.

n When a host name is added, e.g., photon.poly.edu, an entry also needs to be made under the arpa domain. If photon.poly.edu has an IP address of 135.181.103.144, then the structure shown in created under in-ad-dr.arpa. Note it is backwards; A pointer query for 144.103.181.135.in-addr.arpa will yield the name pho-ton.poly.edu

unnamed root

arpa com edu gov mil int net org ae us zw

country domains .... .... poly uconn UAE Zimbabwe in-addr 135 181 103 144 photon

General format of DNS queries/responses

n Identification sent by the client and returned by the server • lets client match responses

identification flags

number of questions number of answer RRs number of additional RRs number of authority RRs

questions answers

(variable number of resource records) authority

(variable number of resource records) additional information (variable number of resource records)

0 15 16 31

12 bytes

(3)

Malathi Veeraraghavan 5

Fields in the DNS queries/responses

n Flags:

• QR: 0 means the message is a query, 1 means it’s a response.

• opcode: 0 (standard query); 1 (inverse query); 2 (server status request) • AA: Authoritative Answer

• TC: Truncated - with UDP, total length of reply> 512 bytes and only first 512 bytes were returned; resolver usually reissues request using TCP

• RD: Recursion Desired - If it is set, name server handles it as a recursive query; If it is not set, and the requested name server does not have an authoritative an-swer, it returns a list of other name servers to contact (iterative query)

• RA: Recursion Available - If this is set to 1 in the response, the name server supports recursion.

• rcode: return code - 0 (no error); 3 (name error). The name error is returned by the authoritative name server if the domain name specified in the query does not exist.

QR opcode AA TC RD RA (zero) rcode 4 3 1 1 1 1 4 1

Question portion of the DNS query message

n The query name is the name being looked up: sequence of one or more labels • Each label begins with a 1-byte count that specifies the no. of bytes to follow • Example: gemini.noc.poly.edu is represented as 6gemini3noc4poly3edu0

n Query type in a question and each response has a type

Name Numeric

Value

Description type? query

type?

A 1 IP address n n

NS 2 name server n n

CNAME 5 canonical name n n

PTR 12 pointer query n n

HINFO 13 host info n n

query type query class = 1

0 15 16 31

(4)

Malathi Veeraraghavan 7

Resource record portion of DNS response

n Domain name: same as the query name

n Type and class: same as the query type and query class

n Time-to-live: number of seconds that the RR can be cached by the client (2 days)

n Resource data length: depends on the type of query; if type=A, resource data is 4 bytes long (IP address)

type class 0 15 16 31 domain name resource data length time-to-live resource data multiple bytes

Applications

n FTP: File Transfer Protocol

n SMTP: Simple Mail Transfer Protocol

n SNMP: Simple Network Management Protocol

n Telnet, Rlogin: Remote login

n NFS: Network File System

(5)

Malathi Veeraraghavan 9

FTP

FTP uses two TCP connections

n control connection: well-known port number at the server = 21

n data connection: well-known port number at the server = 20

user interface user protocol interpreter user data transfer function user at a terminal file system server protocol interpreter server data transfer function data connection control connection (FTP commands/ replies) file system server client

Data representation

n File type

• ASCII, EBCDIC, Image (binary), Local

n Format control

• Nonprint, Telnet format control, Fortran carriage control

n Structure

• File structure, Record structure, Page structure

n Transmission mode

• Stream mode, block mode, compressed mode

n Common UNIX implementations of FTP • ASCII or image type

(6)

Malathi Veeraraghavan 11

FTP commands

Command Description

ABOR Abort previous command and any file transfer

LIST filelist List files or directories

PASS password Password on server

PORT n1, n2, n3, n4, n5, n6 Client IP address (n1.n2.n3.n4) and port ( )

QUIT Logoff from server

RETR filename Retrieve (get) a file

STORE filename Store (put) a file

SYST Server returns system type

TYPE type Specify the file type: ascii or image

USER username Username on server

n5×256+n6

FTP replies

Example replies (replies are 3 digit numbers: meaning of first two digits on page 424 in text book)

• 125 Data connection already open; transfer starting • 200 Command OK

• 214 Help message

• 331 Username OK, password required • 425 Can’t open data connection • 452 Error writing file

• 500 Syntax error (unrecognized command) • 501 Syntax error (invalid arguments) • 502 Unimplemented MODE type

(7)

Malathi Veeraraghavan 13

Connection management

n Control connection stays up for the duration of the client-server connection

n Creation of data connection is under control of client

n Client chooses an ephemeral port number on the client host for its end of the data connection.

n Client sends the PORT command to the server across the control connection

n Server receives the port number and issues an active open to that port on the client host. The server’s end of the data connection always uses port 20.

n Multiple FTP sessions from multiple clients to the same FTP server

FTP client port 1173 port 1174 IP addr 140.252.13.34 FTP server port 21 PORT 140, 252, 13, 34, 4, 150\r\n FTP client port 1173 port 1174 IP addr 140.252.13.34 FTP server port 21 (control connection) SYN to 140.252.13.34 port 1174 (active open)

4x256 + 150 = 1174

port 20

SMTP

n Communication between two MTAs uses NVT (network virtual terminal) ASCII

n SMTP commands

• Send mail: HELO, MAIL, RCPT, DATA, QUIT

User agent user mailboxes message transfer agent message transfer agent queue of mail to be sent User agent user at a terminal user at a terminal sender receiver port 25

(8)

Malathi Veeraraghavan 15

Example

sun% mail [email protected] invokes user agent

To: [email protected] this is output by user agent

Subject: testing

1, 2, 3. user agent adds one blank line;

. this is body of message

Sending letter to [email protected] verbose output from user agent following is output by MTA Connecting to mailhost via ether...

Trying 140.252.1.54.... connected. 220 noao.edu Sendmail 4.1.... >>> HELO sun.tuc.noao.edu

250 noao.edu Hello sun.tuc.noao.edu Client does an active open to port 25 >>> MAIL From: <[email protected]> MAIL command identifies sender 250 <[email protected]> Sender OK

>>> RCPT To: <[email protected]> RCPT command identifies recipient 250 <[email protected]> Recipient OK

>>> DATA DATA command carries actual data

354 Enter mail, end with “.” on a line by itself

Example continued

>>> QUIT terminates mail exchange

221 noao.edu delivering mail [email protected]... Sent

sent. This is output by user agent

Actual data sent: 393 bytes (for just the one line 1, 2, 3?)

Received: by sun.tuc.noao.edu (4.1/SMI-4.1)

id AA00502; Mon, 19 Jul 93 12:47:32 MST Message Id: <[email protected].> From: [email protected] (Richard Stevens) Date: Mon, 19 Jul 1993, 12:47:21 -0700

Reply-To: [email protected] X-Phone: X-Mailer: To: [email protected] Subject: testing 1, 2, 3.

(9)

Malathi Veeraraghavan 17

Other SMTP commands

n RSET: aborts current mail transaction and causes both ends to reset

n VRFY: lets the client ask the sender to verify a recipient address without sending mail to the recipient

n NOOP command does nothing except make the server respond with a 200 OK re-ply code.

n Other optional commands

Envelopes, headers, body

Electronic mail is composed of three pieces:

n Envelope: used by the MTA for delivery; MAIL, RCPT commands

n Headers: used by user agents. Nine header fields in example:

• Received, Message-Id, From, Date, Reply-To, X-Phone, X-Mailer, To, Subject

References

Related documents

In general a new business model covering the entire transport chain from the terminal to the siding and back to the container depot was developed, the SWL production schemes

1 The employee’s primary duty must consist of: 1) the application of systems analysis techniques and procedures, including consulting with users, to determine hardware, software

The purpose of this study is to investigate the factors motivating sustainability development strategies adoption and implementation and to study the relationships between

From January 1967 to July 1968, the money stock had risen at a 7 per cent annual rate, about three times the trend rate from 1957 to 1966, Studies indicate that changes in the

By subtracting all the proteins that were identified as orthologs from the groups of paralogs and unique genes, we were left with only the protein pro- ducts of gene models that

Improved marketing\campaign optimization Deal w ith technical complexity Increasing information about customer Supporting service and sales via the Internet Integration of sales

Theorem 4.10: Every edge-to-edge tiling of the plane by congruent triangles meeting 6 at a vertex formed by dividing the plane by lines, except tilings by isosceles triangles

To assemble the pump, refer to any specific sectional arrangement drawing with the contract. Otherwise section 8 shows the standard sectional drawing for the pump. Note that