Lecture 10 Doman Name System - PowerPoint PPT Presentation

1 / 39
About This Presentation
Title:

Lecture 10 Doman Name System

Description:

SSN, name, passport # Internet hosts, ... implemented in hierarchy of many name servers ... barney.the.purple.dinosaur.com. cnl.cse.unr.edu. DNS. 4. Domain Name ... – PowerPoint PPT presentation

Number of Views:79
Avg rating:3.0/5.0
Slides: 40
Provided by: mgu8
Category:

less

Transcript and Presenter's Notes

Title: Lecture 10 Doman Name System


1
Lecture 10Doman Name System
  • CPE 401 / 601Computer Network Systems

slides are modified from Dave Hollinger and
Kurose Ross
2
Hostnames
  • People many identifiers
  • SSN, name, passport
  • Internet hosts, routers
  • IP address (32/128 bit) - used for addressing
    datagrams
  • name, e.g., ww.yahoo.com - used by humans
  • http//www.youtube.com/watch?v9ilYrY9iBhk
  • IP Addresses are great for computers
  • IP address includes information used for routing.
  • IP addresses are tough for humans to remember.
  • IP addresses are impossible to guess.
  • ever guessed at the name of a WWW site?

3
Domain Name System
  • The domain name system is usually used to
    translate a host name into an IP address .
  • Domain names comprise a hierarchy so that names
    are unique, yet easy to remember.
  • distributed database
  • implemented in hierarchy of many name servers
  • hosts, routers, communicate with name servers to
    resolve names (address/name translation)

4
Host name structure
  • Each host name is made up of a sequence of labels
    separated by periods.
  • Each label can be up to 63 characters
  • The total name can be at most 255 characters.
  • Examples
  • whitehouse.gov
  • barney.the.purple.dinosaur.com
  • cnl.cse.unr.edu

5
Domain Name
  • The domain name for a host is the sequence of
    labels that lead from the host (leaf node in the
    naming tree) to the top of the worldwide naming
    tree.
  • A domain is a subtree of the worldwide naming
    tree.

6
DNS services
  • hostname to IP address translation
  • host aliasing
  • Canonical, alias names
  • mail server aliasing
  • load distribution
  • replicated Web servers set of IP addresses for
    one canonical name
  • Why not centralize DNS?
  • single point of failure
  • traffic volume
  • distant centralized database
  • maintenance

doesnt scale!
7
Distributed, Hierarchical Database
  • Client wants IP for www.unr.edu 1st approx
  • client queries a root server to find edu DNS
    server
  • client queries edu DNS server to get unr.edu DNS
    server
  • client queries unr.edu DNS server to get IP
    address for www.unr.edu

8
DNS Root name servers
  • contacted by local name server that can not
    resolve name
  • root name server
  • contacts authoritative name server if name
    mapping not known
  • gets mapping
  • returns mapping to local name server

a Verisign, Dulles, VA c Cogent, Herndon, VA
(also LA) d U Maryland College Park, MD g US DoD
Vienna, VA h ARL Aberdeen, MD j Verisign, ( 21
locations)
k RIPE London (also 16 other locations)
i Autonomica, Stockholm (plus 28 other
locations)
m WIDE Tokyo (also Seoul, Paris, SF)
e NASA Mt View, CA f Internet Software C. Palo
Alto, CA (and 36 other locations)
13 root name servers worldwide
b USC-ISI Marina del Rey, CA l ICANN Los
Angeles, CA
9
Top-Level Domain Servers
  • responsible for com, org, net, edu, gov,
  • Network Solutions maintains servers for com TLD
  • Educause for edu TLD
  • Countries each have a top level domain
  • 2 letter domain name
  • uk, fr, ca, jp,
  • New top level domains include
  • .aero .biz .coop .info .name .pro

10
Authoritative Servers
  • organizations DNS servers,
  • providing authoritative hostname to IP mappings
    for organizations servers (e.g., Web, mail).
  • The organization that owns a domain name is
    responsible for running a DNS server that can
    provide the mapping between hostnames within the
    domain to IP addresses.
  • So - some machine run by UNR is responsible for
    everything within the rpi.edu domain.
  • can be maintained by organization or service
    provider

11
DNS Distributed Database
  • There is one primary server for a domain, and
    typically a number of secondary servers
    containing replicated databases.

unr.edu DNS server
unr.edu DNS DB
rpi.edu DNS DB
unr.edu DNS DB
rpi.edu DNS DB
Authoritative
Replicas
12
Local Name Server
  • does not strictly belong to hierarchy
  • each ISP (residential ISP, company, university)
    has one.
  • also called default name server
  • when host makes DNS query, query is sent to its
    local DNS server
  • acts as proxy, forwards query into hierarchy

13
DNS caching and updating records
  • once (any) name server learns mapping, it caches
    mapping
  • cache entries timeout (disappear) after some time
  • TLD servers typically cached in local name
    servers
  • Thus root name servers not often visited
  • DNS Cache poisoning attacks
  • http//www.youtube.com/watch?v1d1tUefYn4U
  • update/notify mechanisms under design by IETF
  • RFC 2136
  • http//www.ietf.org/html.charters/dnsind-charter.h
    tml

14
Inserting records into DNS
  • example new startup Network Utopia
  • register name networkuptopia.com at DNS registrar
    (e.g., Network Solutions)
  • provide names, IP addresses of authoritative name
    server (primary and secondary)
  • registrar inserts two RRs into com TLD server
  • (networkutopia.com, dns1.networkutopia.com, NS)
  • (dns1.networkutopia.com, 212.212.212.1, A)
  • create authoritative server
  • Type A record for www.networkuptopia.com
  • Type MX record for networkutopia.com

15
(No Transcript)
16
DNS Clients
  • A DNS client is called a resolver.
  • A call to gethostbyname()is handled by a resolver
    (typically part of the client).
  • Most Unix workstations have the file
    /etc/resolv.conf that contains the local domain
    and the addresses of DNS servers for that domain.

17
/etc/resolv.conf
  • search cse.unr.edu me.unr.edu engr.unr.edu
    ce.unr.edu it.unr.edu unr.edu
  • nameserver 134.197.5.1
  • nameserver 134.197.6.1

18
nslookup
  • nslookup is an interactive resolver that allows
    the user to communicate directly with a DNS
    server.
  • nslookup is usually available on Unix
    workstations.
  • dig and host are also DNS clients

19
DNS Servers
  • Servers handle requests for their domain
    directly.
  • Servers handle requests for other domains by
    contacting remote DNS server(s).
  • Servers cache external mappings.

20
Server - Server Communication
  • If a server is asked to provide the mapping for a
    host outside its domain (and the mapping is not
    in the server cache)
  • The server finds a nameserver for the target
    domain.
  • The server asks the nameserver to provide the
    host name to IP translation.
  • To find the right nameserver, use DNS!

21
DNS Data
  • DNS databases contain more than just
    hostname-to-address records
  • Name server records NS
  • Hostname aliases CNAME
  • Mail Exchangers MX
  • Host Information HINFO

22
Server Operation
  • If a server has no clue about where to find the
    address for a hostname, ask the root server.
  • The root server will tell you what nameserver to
    contact.
  • A request may get forwarded a few times.

23
DNS name resolution example
root DNS server
  • Host at cse.unr.edu wants
  • IP address for rec.dri.edu

2
3
TLD DNS server
4
5
  • iterated query
  • contacted server replies with name of server to
    contact
  • I dont know this name, but ask this server

6
7
1
8
authoritative DNS server dns.dri.edu
requesting host cse.unr.edu
rec.dri.edu
24
Recursion
  • A request can indicate that recursion is desired
    - this tells the server to find out the answer
    (possibly by contacting other servers).
  • If recursion is not requested - the response may
    be a list of other name servers to contact.

25
DNS name resolution example
  • recursive query
  • puts burden of name resolution on contacted name
    server
  • heavy load?

26
UDP TCP
  • Both UDP and TCP are used
  • TCP for transfers of entire database to secondary
    servers (replication)
  • UDP for lookups
  • If more than 512 bytes in response
  • requestor resubmits request using TCP.

27
DNS records
  • DNS distributed db storing resource records (RR)
  • TypeA
  • name is hostname
  • value is IP address
  • TypeCNAME
  • name is alias name for some canonical (the
    real) name
  • www.ibm.com is really
  • servereast.backup2.ibm.com
  • value is canonical name
  • TypeAAA
  • TypeNS
  • name is domain (e.g. foo.com)
  • value is hostname of authoritative name server
    for this domain
  • TypeMX
  • value is name of mailserver associated with name

28
DNS protocol, messages
  • DNS protocol query and reply messages, both
    with same message format
  • identification
  • 16 bit for query,
  • reply to query uses same
  • flags
  • QR Query0, Response1
  • AA Authoritative Answer
  • TC response truncated (gt 512 bytes)
  • RD recursion desired
  • RA recursion available
  • rcode return code

Response
29
DNS protocol, messages
Name, type fields for a query
RRs in response to query
records for authoritative servers
additional helpful info that may be used
30
Name to Address Conversion
  • There is a library of functions that act as DNS
    client (resolver).
  • you dont need to write DNS client code to use
    DNS!
  • With some OSs you need to explicitly link with
    the DNS resolver library
  • -lnsl (nsl is Name Server Library)

Suns (Solaris) need this!
31
DNS library functions
  • gethostbyname
  • gethostbyaddr
  • gethostbyname2

IPV6!
32
gethostbyname
  • Return IP addresses of a host
  • struct hostent gethostbyname( const char
    hostname)
  • struct hostent is defined in netdb.h
  • All the IP addresses returned via the hostent are
    in network byte order!

33
hostent picture
  • h_name
  • h_aliases
  • h_addrtype
  • h_length
  • h_addr_list

34
Which Address?
  • On success, gethostbyname returns the address of
    a hostent that has been created.
  • has an array of ptrs to IP addresses
  • Usually use the first one
  • define h_addr h_addr_list0

35
gethostbyname and errors
  • On error gethostbyname return null.
  • Gethostbyname sets the global variable h_errno to
    indicate the exact error
  • HOST_NOT_FOUND
  • TRY_AGAIN
  • NO_RECOVERY
  • NO_DATA
  • NO_ADDRESS

All defined in netdb.h
36
Getting at the address
  • char h_addr_list
  • h gethostbyname("joe.com")
  • sockaddr.sin_addr.s_addr
  • (h-gth_addr_list0)
  • This won't work!!!!
  • h_addr_list0 is a char !

37
Using memcpy
  • You can copy the 4 bytes (IPv4) directly
  • h gethostbyname("joe.com")
  • memcpy(sockaddr.sin_addr,
  • h-gth_addr_list0,
  • sizeof(struct in_addr))

38
gethostbyaddr
  • Return hostname corresponding to an IP.
  • struct hostent gethostbyaddr( const char addr
  • size_t len,
  • int family)

sizeof(struct in_addr)
AF_INET (could be AF_INET6)
39
Some other functions
  • uname
  • get hostname of local host
  • getservbyname
  • get port number for a named service
  • getservbyaddr
  • get name for service associated with a port
    number
Write a Comment
User Comments (0)
About PowerShow.com