Transcript
Page 1: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

DNS: Domain Name System

CMPSCI 491G: Computer Networking Lab

V. Arun

Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Page 2: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Domain Name System: distributed database

implemented in hierarchy of many name servers

application-layer protocol: hosts, name servers communicate to resolve names addresses note: core Internet

function, implemented as application-layer protocol

complexity at network’s “edge”

Application Layer 2-2

DNS: domain name system

people: many identifiers: SSN, name,

passport #Internet hosts, routers:

IP address (32 bit) - used for addressing datagrams

“name”, e.g., www.yahoo.com - used by humans

Q: how to map between IP address and name, and vice versa ?

Page 3: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Application Layer 2-3

DNS: services, structure why not centralize DNS? single point of failure traffic volume distant centralized

database maintenance

DNS services Resolution

hostname IP address

Aliasing canonical, alias

names mail server aliasing

Load balancing with replicated web servers: many addresses

map to one name

doesn’t scale!

Page 4: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Before there was DNS ….

…. there was the HOSTS.TXT file

• Before DNS (until 1985), name resolution was done by FTP’ing a single file (hosts.txt) from a central server. – Names in hosts.txt are not structured.– hosts.txt still works on most operating systems. It can be

used to define local names.

Page 5: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Design principle of DNS

• DNS naming system based on a hierarchical and logical tree structure called domain namespace.

• An organization obtains authority for parts of the name space, and can add additional layers of the hierarchy

• Names of hosts can be assigned without regard of location on a link layer network, IP network or autonomous system

• In practice, allocation of the domain names generally follows the allocation of IP address, e.g., – All hosts with network prefix 128.143/16 have domain name suffix

virginia.edu– All hosts on network 128.143.136/24 are in the Computer Science

Department of the University of Virginia

Page 6: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Managed by UofT

DNS Name hierarchy

• DNS hierarchy can be represented by a tree

• Root and top-level domains are administered by an Internet central name registration authority (ICANN)

• Below top-level domain, administration of name space is delegated to organizations

• Each organization can delegate further Managed by

ECE Dept.

. (root)

com

toronto.edu

goveduorg

uci.edu

ece.toronto.edumath.toronto.edu

neon.ece.toronto.edu

Top-level Domains

Page 7: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Domain name system

• Each node in the DNS tree represents a DNS name

• Each branch below a node is a DNS domain.– DNS domain can contain

hosts or other domains (subdomains)

• Example: DNS domains are ., edu, virginia.edu, cs.virginia.edu

virginia.edu

cs.virginia.eduwww.virginia.edu

neon.cs.virginia.edu

edu

.

Page 8: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Top-level domains

• Three types of top-level domains:– Organizational: 3-character code indicates the function of

the organization• Used primarily within the US • Examples: gov, mil, edu, org, com, net

– Geographical: 2-character country or region code• Examples: us, va, jp, de

– Expanded top-level domains (gTLDs)• Essentially arbitrary TLDs

– Reverse domains: A special domain (in-addr.arpa) used for IP address-to-name mapping

Page 9: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Organizational top-level domains

com Commercial organizations

edu Educational institutions

gov Government institutions

int International organizations

mil U.S. military institutions

net Networking organizations

org Non-profit organizations

Page 10: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Hierarchy of name servers

• The resolution of the hierarchical name space is done by a hierarchy of name servers

• Each server is responsible (authoritative) for a contiguous portion of the DNS namespace, called a zone.

• Zone is a part of the subtree

• DNS server answers queries about hosts in its zone

root server

com servergov serveredu serverorg server

uci.eduserver

.virginia.edu server

cs.virginia.edu server

Page 11: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Authority and delegation

• Authority for the root domain is with the Internet Corporation for Assigned Numbers and Names (ICANN)

• ICANN delegates to accredited registrars (for gTLDs) and countries for country code top level domains (ccTLDs)

• Authority can be delegated further

• Chain of delegation can be obtained by reading domain name from right to left.

• Unit of delegation is a “zone”.

Page 12: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

DNS domain and zones

• Each zone is anchored at a specific domain node, but zones are not domains.

• A DNS domain is a branch of the namespace

• A zone is a portion of the DNS namespace generally stored in a file (could consist of multiple nodes)

• A server can divide part of its zone and delegate it to other servers

. (root)

.virginia.edu

.edu

.uci.edu

cs.virginia.edumath.virginia.edu

DomainZone

anddomain

Zone

Page 13: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Primary and secondary name servers

• For each zone, there must be a primary name server and a secondary name server– The primary server (master server) maintains a zone file which has

information about the zone. Updates are made to the primary server– The secondary server copies data stored at the primary server.

Adding a host:• When a new host is added (“gold.cs.virginia.edu”) to a zone, the

administrator adds the IP information on the host (IP address and name) to a configuration file on the primary server

Page 14: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Application Layer 2-14

Root DNS Servers

com DNS servers org DNS servers edu DNS servers

poly.eduDNS servers

umass.eduDNS servers

yahoo.comDNS servers

amazon.comDNS servers

pbs.orgDNS servers

DNS resolution: distributed, hierarchical

client wants IP for www.amazon.com; 1st approx: client queries root server to find .com TLD DNS server client queries .com TLD DNS server for amazon.com

auth server client queries amazon.com DNS auth server to get IP

address for www.amazon.com

… …Top-level domain servers

Authoritative name servers

Page 15: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Application Layer 2-15

DNS: root name servers contacted when no info about top-level or auth

server root name server can:

return top-level or auth name server address or contact auth server and return final resolved

address

13 root name “servers” worldwide

a. Verisign, Los Angeles CA (5 other sites)b. USC-ISI Marina del Rey, CAl. ICANN Los Angeles, CA (41 other sites)

e. NASA Mt View, CAf. Internet Software C.Palo Alto, CA (and 48 other sites)

i. Netnod, Stockholm (37 other sites)

k. RIPE London (17 other sites)

m. WIDE Tokyo(5 other sites)

c. Cogent, Herndon, VA (5 other sites)d. U Maryland College Park, MDh. ARL Aberdeen, MDj. Verisign, Dulles VA (69 other sites )

g. US DoD Columbus, OH (5 other sites)

Page 16: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Application Layer 2-16

TLD, authoritative servers

top-level domain (TLD) servers: responsible for com, org, net, edu, aero, jobs,

museums, and all top-level country domains, e.g.: uk, fr, ca, jp

Network Solutions maintains servers for .com TLD

Educause for .edu TLD

authoritative DNS servers: organization’s own DNS server(s), providing

authoritative hostname to IP mappings for organization’s named hosts

can be maintained by organization or service provider

Page 17: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Application Layer 2-17

Local DNS name server

does not strictly belong to hierarchy deployed by ISP (residential, company,

university) also called “default name server”

acts as proxy between host and DNS hierarchy has local cache of recent name-to-address

translation pairs (but may be out of date!)

Page 18: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Application Layer 2-18

requesting hostcis.poly.edu

gaia.cs.umass.edu

root DNS server

local DNS serverdns.poly.edu

1

23

4

5

6

authoritative DNS serverdns.cs.umass.edu

78

TLD DNS server

DNS name resolution example

host at cis.poly.edu wants IP address for gaia.cs.umass.edu

iterated query: contacted server

replies with name of server to contact

“I don’t know this name, but ask this server”

Page 19: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Application Layer 2-19

45

6

3

recursive query: puts burden of

name resolution on contacted name server

heavy load at upper levels of hierarchy?

requesting hostcis.poly.edu

gaia.cs.umass.edu

root DNS server

local DNS serverdns.poly.edu

1

27

authoritative DNS serverdns.cs.umass.edu

8

DNS name resolution example

TLD DNS server

Page 20: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Application Layer 2-20

DNS: caching, updating records any name server can cache learned

mappings cache entries timeout (disappear) after some

time (TTL) TLD servers typically cached in local name

servers, so root name servers not often visited cached entries may be out-of-date (best

effort name-to-address translation!) if name host changes IP address, may not be

known Internet-wide until all TTLs expire update/notify mechanisms proposed IETF

standard RFC 2136

Page 21: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Application Layer 2-21

DNS records

DNS: distributed db storing resource records (RR)

type=NS name is domain (e.g.,

foo.com) value is hostname of

authoritative name server for this domain

RR format: (name, value, type, ttl)

type=A name is hostname value is IP address

type=CNAME name is alias name for some

“canonical” (the real) name www.ibm.com is really servereast.backup2.ibm.com value is canonical name

type=MX value is name of

mailserver associated with name

Page 22: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Application Layer 2-22

DNS protocol, messages query and reply messages, both with same message format

msg header identification: 16 bit #

for query, reply to query uses same #

flags: query or reply recursion desired recursion available reply is authoritative

identification flags

# questions

questions (variable # of questions)

# additional RRs# authority RRs

# answer RRs

answers (variable # of RRs)

authority (variable # of RRs)

additional info (variable # of RRs)

2 bytes 2 bytes

Page 23: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Application Layer 2-23

name, type fields for a query

RRs in responseto queryrecords for

authoritative servers

additional “helpful”info that may be used

identification flags

# questions

questions (variable # of questions)

# additional RRs# authority RRs

# answer RRs

answers (variable # of RRs)

authority (variable # of RRs)

additional info (variable # of RRs)

DNS protocol, messages

2 bytes 2 bytes

Page 24: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Application Layer 2-24

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

Page 25: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Resource Records

• The database records of the distributed data base are called resource records (RR)

• Resource records are stored in configuration files (zone files) at name servers.

• Resource records for a zone:

db.mylab.com $TTL 86400 mylab.com. IN SOA PC4.mylab.com. hostmaster.mylab.com. ( 1 ; serial 28800 ; refresh 7200 ; retry 604800 ; expire 86400 ; ttl ) ; mylab.com. IN NS PC4.mylab.com. ; localhost A 127.0.0.1 PC4.mylab.com. A 10.0.1.41 PC3.mylab.com. A 10.0.1.31 PC2.mylab.com. A 10.0.1.21 PC1.mylab.com. A 10.0.1.11

Page 26: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Resource Records

db.mylab.com $TTL 86400 mylab.com. IN SOA PC4.mylab.com. hostmaster.mylab.com. ( 1 ; serial 28800 ; refresh 7200 ; retry 604800 ; expire 86400 ; ttl ) ; mylab.com. IN NS PC4.mylab.com. ; localhost A 127.0.0.1 PC4.mylab.com. A 10.0.1.41 PC3.mylab.com. A 10.0.1.31 PC2.mylab.com. A 10.0.1.21 PC1.mylab.com. A 10.0.1.11

Max. age of cached data in seconds

* Start of authority (SOA) record. Means: “This name server is authoritative for the zoneMylab.com” * PC4.mylab.com is the name server* [email protected] is the email address of the person in charge

Name server (NS) record. One entry for each authoritative name server

Address (A) records. One entry for each hostaddress

Page 27: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Lab 7 (DHCP/NAT) review

Page 28: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Exercise 1(B)-3

28

NAT Table on Router2Router2#show ip nat translationsPro Inside global Inside local Outside local Outside global--- 200.0.0.2 10.0.1.2 --- ---

Which ping works and why?PC3% ping –c3 10.0.1.3PC3% ping –c3 128.143.136.1

Router3% ping –c3 10.0.1.2Router3% ping –c3 128.143.136.1

PC4% ping –c3 10.0.1.2PC4% ping –c3 200.0.0.2

Configuration:Router2(config)#ip nat inside source static 10.0.1.2 200.0.0.2.. ..PC4% route add –net 200.0.0.0 netmask 255.255.255.0 gw 128.195.7.32

Page 29: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Exercise 1(B)-3

29

NAT Table on Router2Router2#show ip nat translationsPro Inside global Inside local Outside local Outside global--- 200.0.0.2 10.0.1.2 --- ---

Which ping works and why?PC3% ping –c3 10.0.1.3PC3% ping –c3 128.143.136.1

Router3% ping –c3 10.0.1.2Router3% ping –c3 128.143.136.1

PC4% ping –c3 10.0.1.2PC4% ping –c3 200.0.0.2

Configuration:Router2(config)#ip nat inside source static 10.0.1.2 200.0.0.2.. ..PC4% route add –net 200.0.0.0 netmask 255.255.255.0 gw 128.195.7.32

Page 30: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Exercise 1(B)-4

30

NAT Table on Router2Router2#show ip nat translationsPro Inside global Inside local Outside local Outside global--- 200.0.0.1 10.0.1.1 --- ------ 200.0.0.2 10.0.1.2 --- ------ 200.0.0.3 10.0.1.3 --- ---

Which ping works and why?PC3% ping –c3 10.0.1.3PC3% ping –c3 128.143.136.1

Router3% ping –c3 10.0.1.2Router3% ping –c3 128.143.136.1

PC4% ping –c3 10.0.1.2PC4% ping –c3 200.0.0.2

Configuration:Router2(config)#ip nat inside source static 10.0.1.2 200.0.0.2Router2(config)#ip nat inside source static 10.0.1.1 200.0.0.1Router2(config)#ip nat inside source static 10.0.1.3 200.0.0.3

Page 31: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Exercise 1(B)-4

31

NAT Table on Router2Router2#show ip nat translationsPro Inside global Inside local Outside local Outside global--- 200.0.0.1 10.0.1.1 --- ------ 200.0.0.2 10.0.1.2 --- ------ 200.0.0.3 10.0.1.3 --- ---

Which ping works and why?PC3% ping –c3 10.0.1.3PC3% ping –c3 128.143.136.1

Router3% ping –c3 10.0.1.2Router3% ping –c3 128.143.136.1

PC4% ping –c3 10.0.1.2PC4% ping –c3 200.0.0.2

Configuration:Router2(config)#ip nat inside source static 10.0.1.2 200.0.0.2Router2(config)#ip nat inside source static 10.0.1.1 200.0.0.1Router2(config)#ip nat inside source static 10.0.1.3 200.0.0.3

Page 32: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Exercise 1(B)

32

Before Router2:Src: 10.0.1.2 (10.0.1.2), Dst: 128.143.136.1 (128.143.136.1)

Show IP source/destination addresses before/after Router2PC3% ping –c3 128.143.136.1

After Router2:Src: 200.0.0.2 (200.0.0.2), Dst: 128.143.136.1 (128.143.136.1)

NAT Table on Router2Router2#show ip nat translationsPro Inside global Inside local Outside local Outside global--- 200.0.0.1 10.0.1.1 --- ------ 200.0.0.2 10.0.1.2 --- ------ 200.0.0.3 10.0.1.3 --- ---

Page 33: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Exercise 1(C)- NAT/PAT/Masquerade

33

telnet commands; which one successful?PC1% telnet 10.0.1.3 (Router1)PC1% telnet 128.143.136.1 (PC4)

Router1# telnet 10.0.1.2 (PC1)Router1# 128.143.136.1 (PC4)

PC4: telnet 10.0.1.2 (Router2)

Page 34: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Exercise 1(C)- NAT/PAT/Masquerade

34

telnet commands; which one successful?PC1% telnet 10.0.1.3 (Router2)PC1% telnet 128.143.136.1 (PC4)

Router1# telnet 10.0.1.2 (PC1)Router1# 128.143.136.1 (PC4)

PC4: telnet 10.0.1.2 (Router2)

Page 35: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Exercise 1(C)- NAT & telnet

35

PC1% telnet 128.143.136.1 (PC4)

Before translation (PC2)Internet Protocol Source: 10.0.1.2 Destination: 128.143.136.1Transmission Control Protocol Source port: 32774 Destination port: telnet (23) Sequence number: 1857633137

After translation (PC2)Internet Protocol Source: 128.143.136.22 Destination: 128.143.136.1Transmission Control Protocol Source port: 32774 Destination port: telnet (23) Sequence number: 1857633137

Page 36: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Exercise 1(C)- PAT & ICMP (ping)

36

PC1% ping 128.143.136.1 (PC4)

Internet Protocol, Src Addr: 10.0.1.2, Dst Addr: 128.143.136.1 Identification: 0x0000 Protocol: ICMP (0x01) Source: 10.0.1.2 Destination: 128.143.136.1

Internet Protocol, Src Addr: 128.143.136.22, Dst Addr: 128.143.136.1 Identification: 0x0000 Protocol: ICMP (0x01) Source: 128.143.136.22 Destination: 128.143.136.1

•Ping (ICMP) does not use port number•“Identification” is used to help with NAT

Page 37: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Exercise 1(D)- NAT & FTP

FTP uses 2 ports Control connection, port 21 Data connection port 20

No problem with NAT & control connection. For data connection, the server initiates a

connection from its port 20 to a (random) port on client Causes problem with NAT Only client can initiate connection

PASSIVE mode solves this problem

37

Page 38: DNS: Domain Name System CMPSCI 491G: Computer Networking Lab V. Arun Slides adapted from Liebeherr & Zarki, Kurose & Ross, Kermani

Exercise 1(D)- NAT & FTP

38

PC3% ftp 128.143.136.22 (PC2)


Top Related