47
Forouzan: Chapter 17 Domain Name System (DNS)

Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Forouzan: Chapter 17

Domain NameSystem(DNS)

Page 2: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Domain Name System (DNS)

Need System to map name to an IP address and vice versa

We have used a host file in our Linux laboratory.

Not feasible for the entire Internet. Thus, divide huge amount of info and store in parts on many different computers. Host needing info contacts the closest server containing the needed info. This is DNS.

Hierarchical Name Space is used. Names are made up of several parts: acme.gatech.edu

Domain Name Space: names are defined in an inverted tree structure. Read names from node up to root of tree.

Source: TCP/IP Protocol Suite by Forouzan

Page 3: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

CONTENTSCONTENTS• NAME SPACE• DOMAIN NAME SPACE• DISTRIBUTION OF NAME SPACE• DNS IN THE INTERNET• RESOLUTION• DNS MESSAGES• TYPES OF RECORDS• COMPRESSION• EXAMPLES• DDNS• ENCAPSULATION

Page 4: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

DOMAINNAMESPACE

17.217.2

Page 5: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Domain name space

Page 6: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Domain namesand labels

Page 7: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

FQDN and PQDN

Page 8: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Domains

Page 9: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

DISTRIBUTION OF

NAME SPACE

17.317.3

Page 10: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

DNS servers are used to distribute the info among many servers. We use a hierarchy of serversjust like the hierarchy of names.

Page 11: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

What a server has authority for is called a zone. A root server’s zone is the whole tree.We use primary and redundant servers.

Page 12: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

A primary server loads all information from A primary server loads all information from the disk file; the secondary server loads the disk file; the secondary server loads

all information from the the primary server. all information from the the primary server. When the primary downloads information When the primary downloads information

from the secondary, it is called from the secondary, it is called zone transfer.zone transfer.

Page 13: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

DNS IN THE

INTERNET

17.417.4

Page 14: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

DNS in the Internet

Page 15: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

There are now 20generic domains,

including .biz,.info,.jobs, etc.

Generic domains

Page 16: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Country domains

Page 17: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Inverse domain

Page 18: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

RESOLUTION

1717..55

Page 19: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

DNS uses a client server architecture. A host needing info contacts a client named a resolver. The resolver client contacts a DNS server.

Recursive Resolution:The resolver asks for a recursive answer from a DNS server. The server must respond with the complete answer. If it does not know the answer the server itself asks a parent server in the hierarchy. If the parent does not know, the parent asks a higher level server in the hierarchy. Eventually the resolver will be told the answer by the first DNS server the resolver contacted.

Iterative Resolution:If client does not specify a recursive answer, client will get an iterative answer.This means if the first server contacted does not know the answer, the server returns the IP address of what the server thinks is a smarter server.This continues until the answer is found.

Resolution

Page 20: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

DNS uses either TCP or UDP. Always port 53. UDP is used when messages are less than512 bytes because many UDP implementations have a 512 byte maximum size limit.

If message larger than 512 bytes:

If client knows message is larger than 512 it will use a TCP connection

If client does not know size of message opens a UDP port to server,

but if the response is larger than 512, server truncates response and sets

the TC bit as a sign to the client to try again using a TCP connection instead.

Protocol that transports DNS messages

Page 21: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Recursive resolution

Page 22: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Here is a typical list of root servers held by a typical name server:; This file holds the information on root name servers

; needed to initialize cache of Internet domain name

; servers (e.g. reference this file in the

; "cache . <file>" configuration file of BIND domain

: name servers).

;

; This file is made available by InterNIC registration

; services under anonymous FTP as

; file /domain/named.root

; on server FTP.RS.INTERNIC.NET

; last update: Aug 22, 1997

; related version of root zone: 1997082200

;

;

; formerly NS.INTERNIC.NET

;

. 3600000 IN NS A.ROOT-SERVERS.NET.

A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4

;

; formerly NS1.ISI.EDU

;

. 3600000 NS B.ROOT-SERVERS.NET.

B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107

;

; formerly C.PSI.NET

;

. 3600000 NS C.ROOT-SERVERS.NET.

ETC……

Source:http://computer.howstuffworks.com/dns5.htm

Page 23: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Iterative resolution

Page 24: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

DNSMESSAGES

17.17.66

Page 25: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

DNS messages

Page 26: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

DNS Message Formats

Two basic types: Query and Response

Page 27: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Identification: 2 byte field so client may match response to the question. Client creates number,Server just repeats the number in the request

Flags: QR Query/Response: One bit 0=query 1=responseOpcode: four bits define type of query or response 0=normal, 1=inverse, 2=server status

is requestedAA authoritative answer: One bit value of 1 means server responding is authoritative serverTC truncated: One bit if it equals 1 means answer was larger than than 512 bytes and was truncated RD recursion desired: one bit if set to 1 means we want a recursive answerRA recursion available: One bit when set to 1 means a recursive response is available. This isset only in the response messageReserved: three bit field set to 000rCode: Four bit field contains error status

Number of Question Records: two byte field with number of queries in the question section of the message

Number of Answer Records: two byte field with number of answers contained in answer section of the message

Number of Authoritative Records: Two byte field containing the number of authoritative records in theauthoritative records section of a response message

Number of Additional Records: Two byte field containing the number additional records in the additional section of a response message.

Header:

Page 28: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Question Section: Section consisting of one or more question records. Exists in both query and response

Answer Section: Section consisting of one or more answer records. Exists in response only.

Authoritative Section: Section consisting of one or more resource records. Exists in response only. This contains the domain name about one or more of the authoritative servers for the query.

Additional Info Section: Contains one or more resource records. Exists in response only.

Remainder of DNS Message Format

Page 29: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

TYPESOF

RECORDS

17.717.7

Page 30: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Types of Records

Two Types of Records in DNS

•Question Records are found in Query section and response section of DNS messages. We echo the question record in the response in case you forgot your question before you get your answer :>)•Resource Records are used in the answer section, authoritative section, and additional section of a response message

Question RecordQuestion Record used to get info from server.

Resource RecordResource records are returned from server to client

Page 31: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Query Name: Variable length field containing a domain name

Query Type: 2 byte field containing the type of query:Type Mnemonic Details1 A IP Address. Convert domain name to IP address2 NS Name Server. IDs authoritative server for a zone5 CNAME Canonical Name. Check if name is an alias12 PTR Convert IP address to domain name (inverse query)etc

Query Class: 2 Byte field specifying the protocol using DNS. Internet has a value of 1.

Question Record Format

(Each count byte is a binary value between 0 and 63, count bytes are not ASCII)

Page 32: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Resource Record FormatResource records are returned from server to client

Domain Name: Variable length field containing domain name

Domain Type: Same as query type field from before but a reduced “Query type” list

Domain Class: 2 Byte field specifying the protocol using DNS. Internet has a value of 1.

Time to Live: 4 byte field with number of seconds answer is valid. Receiver can cache this

answer for this period of time (0 means do not cache)

Resource Data Field Length: 2 bytes representing the length of the resource data field

Resource Data: Variable length field containing answer to query

Page 33: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

COMPRESSION

17.817.8

Page 34: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Format of an offset pointer

Page 35: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

EXAMPLES

Page 36: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Example 1Example 1

A resolver sends a query message to a localserver to find the IP address for the host“chal.fhda.edu.”. We discuss the query andresponse messages separately.

Page 37: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Example 1 QueryResolver sends query to a local server to find the IP address for chal.fhda.edu

ID = 0x1333 is used to match response to this query ID.Flags: QR=0 Opcode=0000 AA=0 TC=0 RD=1 RA=0 Reserved=000 rcode=0000So QR defines this message as a query not a response; opcode means standard query,Recursion desired, one question record for the domain chal.fhda.edu; query type=1 soThis is an IP address query, last two bytes =1 means we are using Internet protocol.

Page 38: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Example 1 Response

Flags: QR=1 Opcode=0000 AA=0 TC=0 RD=1 RA=1 Reserved=000 rcode=0000QR=1 response; Opcode=0000 standard response; RA and RD = 1 meaning recursion desiredand recursion available; the next two fields=1 meaning message contains one question record and one answer record; next two fields = 0 meaning no authoritative and no additional records;The question record is echoed; Next field is domain name but using a DNS offset pointer (see next slide) The Domain type=1 meaning IP address; The Domain class = 1 meaning Internet; Time to Live = 12000 seconds; The Resource data length = 4 meaning returning 4 bytes, the last Four fields are the returned IP address of 153.18.8.105

Header

Question record echoed

Answer section with One answer record

Page 39: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

DNS does not repeat a domain name in an answer record when we have it echoed in thequestion section of the same message. This is called compression.

Instead of repeating DNS messages use an offset value to say how many bytes afterthe beginning of the message we can find the domain name already included in the message.

The pointer has the format:

Where the “address of the beginning byte” is counted in bytes from the beginning of the entire message. Start counting with zero as the first byte.

So in our example 0xC00C is 1100 0000 0000 1100 which means 1100 offset which is 12 bytes from the beginning of the entire DNS message.

Whew!

DNS Offset Pointer

Page 40: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Example 2Example 2

An FTP server has received a packet from anFTP client with IP address 153.2.7.9. TheFTP server wants to verify that the FTPclient is an authorized client.

Page 41: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Example 2 Query

Client asks for inverse query to find name for an IP address of 153.2.7.9

ID = 0x1200 is used to match response to this query ID.

Flags = QR=0 Opcode=0001 AA=0 TC=0 RD=1 RA=0 Reserved=000 rcode=0000

So QR defines this message as a query; opcode means inverse query,

Recursion desired, one question record for the domain 9.7.2.153.in-addr.arpa.

query type=12 so PTR meaning convert IP address to a domain name, last two bytes =1means this is Internet protocol we are using

Page 42: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Example 2 Response

Flags: QR=1 Opcode=0001 AA=1 TC=0 RD=1 RA=1 Reserved=000 rcode=0000QR=1 response; Opcode=0001 standard response; AA=1 Authoritative answer; TC = 0 usingUDP and message fits; RA and RD = 1 meaning recursion desired and recursion available; thenext two fields=1 meaning message contains one question record and one answer record;next twofields = 0 meaning no authoritative and no additional records;The question record is echoed; Nextfield is a DNS offset pointer 0xC00C; The Domain type=12 meaning domain name; The Domainclass = 1 meaning Internet; Time to Live = 24000 seconds; The Resource data length = 10meaning returning 10 bytes, the last field is the name “mhhe.com.”

Page 43: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

DDNS

17.917.9

Page 44: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

Dynamic Domain Name Service

DNS master database must be updated dynamically

After a binding between a name and an IP has taken place, DHCP sends this info to a primaryDNS server

Primary Server updates the zone and sends message to secondary server

BIND (Berkeley Internet Name Domain) is an implementation of DNS, both server and client.

See: http://www.intac.com/~cdp/cptd-faq/

Page 45: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

ENCAPSULATION

17.1017.10

Page 46: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have

DNS can use the services ofDNS can use the services ofUDP or TCPUDP or TCP

using the well-known port 53.using the well-known port 53.

Page 47: Forouzan: Chapter 17 Domain Name System (DNS)users.ece.gatech.edu/dblough/4110/DNS.pdf · Domain Name System (DNS) Need System to map name to an IP address and vice versa We have