DNS - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

DNS

Description:

Reverse DNS. We have the IP address, but want the name. Use DNS on itself ... Internet address is reversed in the lookup. E.g. 3.13.6.128.in-addr.arpa == remus ... – PowerPoint PPT presentation

Number of Views:72
Avg rating:3.0/5.0
Slides: 28
Provided by: Richard1096
Category:
Tags: dns | address | lookup | reverse

less

Transcript and Presenter's Notes

Title: DNS


1
DNS
2
Domain Name System (DNS)
  • Problem statement
  • Average brain can easily remember 7 digits
  • On average, IP addresses have 10.28 digits
  • We need an easier way to remember IP addresses
  • Solution
  • Use alphanumeric names to refer to hosts
  • Add a distributed, hierarchical protocol (called
    DNS) to map between alphanumeric host names and
    IP addresses
  • We call this Name Resolution

3
Domain Name Hierarchy
...
...
com
edu
net
gov
int
mil
org
ae
us
zw
rutgers
yale
yahoo
cnn
Country Domains
cs
eng
Generic Domains
4
Domain Name Management
  • The domain name hierarchy is divided into zones
  • Zone A separate portion of the DNS hierarchy
  • No two zones should overlap
  • Name servers
  • In each zone, there is a primary name server and
    one or more secondary name servers
  • Name servers contain two kinds of address
    mappings
  • Authoritative mappings For hosts within the zone
  • Cached mappings For previously requested
    mappings to hosts not in the zone

5
Domain Name Hierarchy
...
...
com
edu
net
gov
int
mil
org
ae
us
zw
rutgers
yale
yahoo
cnn
cs
eng
6
DNS Protocol
  • When client wants to know an IP address for a
    host name
  • Client sends a DNS query to the primary name
    server in its zone
  • If name server contains the mapping, it returns
    the IP address to the client
  • Otherwise, the name server forwards the request
    to the root name server
  • The request works its way down the tree toward
    the host until it reaches a name server with the
    correct mapping

7
DNS ProtocolExample
remus
Scenario remus tries to resolve an IP address
for venus.cs.yale.edu using a recursive query
1
8
ns-lcsr
2
7
a.root-servers.net
3
6
yale.edu
4
5
cs.yale.edu
8
DNS ProtocolAnother Example
remus
1
2
ns-lcsr
Some servers do not support Recursive queries
3
4
a.root-servers.net
5
6
Scenario remus tries to resolve an IP address
for venus.cs.yale.edu using an iterative query
yale.edu
7
8
cs.yale.edu
9
DNS Packets
  • Clients communicate with DNS servers using either
    TCP or UDP on port 53

0
15 16

31
Transaction Identification
Flags
Number of Questions
Number of Answer RRs
Number of Authoritative RRs
Number of Additional RRs
Questions (variable length)
Answer Resource Records (variable length)
Authoritative Resource Records (variable length)
Additional Resource Records (variable length)
10
DNS Packet Fields
  • Transaction Identification Random number used
    to match client queries with name server
    responses
  • Flags
  • QR 0Query, 1Response
  • opcode 0standard query, 1inverse query,
    2status request
  • AA Authoritative answer
  • TC Truncated DNS packet
  • RD Recursion desired
  • RA Recursion available
  • rcode Return code. 0no error, 3name error

1 4 1
1 1 1 3
4
QR
opcode
AA
TC
RD
RA
(unused)
rcode
11
DNS Packet Fields (contd)
  • Transaction Identification Random number used
    to match client queries with name server
    responses
  • Number of Questions Number of DNS queries in
    the packet
  • Number of Answer RRs Number of
    non-authoritative DNS responses in the packet
  • Number of Authoritative RRs Number of
    authoritative DNS responses in the packet
  • Number of Additional RRs Number of other DNS
    responses in the packet (usually contains other
    DNS servers in domain)
  • Questions Answers Variable length fields to
    store DNS queries and DNS server responses

12
DNS Queries
DNS Packet Question field contains a sequence of
queries
Query name (variable length)
Query Type
Query Class
Query Name Contains an encoded form of the name
for which we are seeking an IP address Query
Type 1IP address, 2name server, 12pointer
record, etc. Query Class 1Internet address
13
Encoding Query Names
  • DNS queries must be encoded in a special way
  • Divide host address into segments whenever a
    period appears
  • For each segment, store a byte representing the
    length of the segment followed by the letters in
    the segment
  • Store a zero byte at the end of the query

14
Encoding Query NamesExample
remus
remus rutgers edu
NOTE These count fields are not the ASCII
characters 5, 7, 3 and 0!!!
15
DNS Responses
DNS Packet RR fields contain a sequence of
resource records
Domain name (variable length)
Type
Class
Time-to-live
Resource Data (variable
length)
Resource data length
  • Domain Name Encoded domain name for query
  • Type Class Same as for query (1IP
    1Internet)
  • Time-to-Live How long this responses will be
    useful
  • Resource Data Contains the four-byte IP address

16
DNS Compression
  • DNS responses are often compressed to save space
  • Compression algorithm
  • If all or part of the domain name field appears
    earlier in the packet (e.g., in a prior RR), then
    store a pointer to the earlier copy instead
  • Pointer 2-byte code

1
1
Index Pointer into DNS Response Packet
17
DNS Caching
  • Going to the root server and then down the tree
    every time we need to resolve an address is
    inefficient
  • Introduce address caching at name servers
  • Store host-to-IP-address mappings from recently
    requested host names at name server
  • When the same address is requested later, use the
    cached version at the local name server instead
    of recursively querying other name servers again

18
DNS CachingExample
remus
1
8
First time remus tries to resolve an IP
address for venus.cs.yale.edu using a recursive
query
Later venus.cs.yale.edu has been cached at
ns-lcsr. remus (and any other host that uses
ns-lcsr) will receive the cached IP address for
venus.cs.yale.edu
ns-lcsr
remus
2
7
1
2
a.root-servers.net
ns-lcsr
3
6
yale.edu
4
5
cs.yale.edu
19
DNS Negative CachingExample
remus
1
8
First time remus tries to resolve an IP
address for hoopla.cs.yale.edu using a recursive
query
Later hoopla.cs.yale.edu has been cached at
ns-lcsr. remus (and any other host that uses
ns-lcsr) will receive the cached answer for
hoopla.cs.yale.edu There is no such name
ns-lcsr
remus
2
7
1
2
a.root-servers.net
ns-lcsr
3
6
yale.edu
4
5
cs.yale.edu
20
Interface to DNS
  • nslookup provides interface to DNS
  • Default maps name-IP address or IP address-name
  • nslookup remus.rutgers.edu
  • Server ns-lcsr.rutgers.edu
  • Address 128.6.4.4
  • Name remus.rutgers.edu
  • Address 128.6.13.3

21
Bootstrapping DNS
  • Sockets work on IP address only
  • Socket class does a DNS lookup if given the
    string name to connect to.
  • Q how does a host contact the name server if all
    it has is the name and no IP address?

22
Bootstrapping DNS
  • IP address of at least 1 nameserver must be given
    a priori
  • or with another protocol (bootp, see later)
  • File /etc/resolv.conf in unix
  • Start - settings- control panel- network
    -TCP/IP - properties in windows

23
Default Domains
  • When Host issues a query to DNS server, can add
    the default domain.
  • Default domain added to end of ever DNS query
  • Domain search order specified in resolv.conf as
    well

24
Authoritative answers
  • server sets this bit if
  • it has the file for the zone
  • If it is a secondary server for the zone
  • not set if
  • cached entry

25
BIND vs. DNS
  • BIND (Berkeley Internet Name Daemon) is a (the?)
    program which implements DNS
  • DNS is the protocol specification
  • Some concepts are BIND, some are DNS
  • primary, secondary, caching only
  • How could you tell?

26
zone transfers
  • ask DNS server for all records for a zone
  • Good for
  • debugging
  • secondary servers
  • bad for security

27
Reverse DNS
  • We have the IP address, but want the name
  • Use DNS on itself
  • Special domain, in-addr.arpa domain for reverse
    lookups
  • Internet address is reversed in the lookup
  • E.g. 3.13.6.128.in-addr.arpa remus
  • Follows least- most specific convention
Write a Comment
User Comments (0)
About PowerShow.com