Professional Documents
Culture Documents
Dns - Domain Name Service: Weesan Lee
Dns - Domain Name Service: Weesan Lee
Service
Introduction
The DNS Namespace
Top-level Domains
Second-level Domains
Domain Names
How to Register a Domain Name?
How DNS Works?
BIND
Tools
Q&A
Introduction
http://www.cs.berkeley.edu/
R
Q Q
momo.cs.ucr.edu edu
A R
A Q Q
eon
R
berkeley.edu
cs.berkeley.edu
The DNS Namespace
Examples
ucr.edu
sony.co.jp
Must apply to a registrar for the appropriate
TLD
Network Solutions, Inc used to monopolize
the name registration
Now, ~500 registrars
Domain Names
Delegation
All name servers read all the 13 root servers from
a local configuration file
[a-m].root-servers.net
$ dig
Those servers in turn knows all the TLDs
.edu knows .ucr.edu
.com knows .google.com
etc
DNS Caching
Recursive
Queries on a client behalf until it returns either an
answer or an error
Non-recursive
Refers the client to another server if it can’t
answer a query
DNS Database
options {
directory "/var/named";
// query-source address * port 53;
forwarders { 138.23.169.10; };
};
zone "." IN {
type hint;
file "named.ca"; // Read from /var/named/named.ca
};
/etc/named.conf
zone "localhost" IN {
type master;
file "localhost.zone"; // Read from /var/named/localhost.zone
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local"; // Read from /var/named/named.local
allow-update { none; };
};
/etc/named.conf
zone "voicense.com" IN {
type master;
file "voicense.com.zone";
};
zone "0.0.10.in-addr.arpa" IN {
type master;
file "voicense.com.rev";
};
zone "macrohard.com IN {
type slave;
file "macrohard.com.zone.bak";
masters { 10.0.0.1; };
};
/var/named/voicense.com.zone
Email address: Remember to
weesan@voicense.com increment the serial #
$TTL 86400 after each editing
$ORIGIN voicense.com.
@ IN SOA voicense.com. weesan.voicense.com. (
20040304 ; serial #
7200 ; refresh (2 hrs)
1800 ; retry (30 mins)
604800 ; expire (1 week)
7200 ) ; mininum (2 hrs)
IN NS ns.voicense.com.
IN MX 10 mail.voicense.com.
IN MX 20 mail.myisp.com.
IN A 10.0.0.1
mail IN CNAME voicense.com.
www IN CNAME voicense.com.
ns IN CNAME voicense.com.
lee IN A 10.0.0.31
wee IN A 10.0.0.32
/var/named/voicense.com.zone
Serial #
An increasing integer number (for sync’ing)
Refresh
How often the slave servers should sync. with the master
Retry
How long the slave servers should retry before giving up
Expire
How long should the slave servers continue to serve the
domains in the absent of the master
Mininum
TTL for negative answers that are cached
/var/named/voicense.com.rev
$TTL 86400
@ IN SOA voicense.com. weesan.voicense.com. (
20040304 ; serial #
7200 ; refresh (2 hrs)
1800 ; retry (30 mins)
604800 ; expire (1 week)
7200 ) ; mininum (2 hrs)
IN NS ns.voicense.com.
1 IN PTR fw.voicense.com.
31 IN PTR lee.voicense.com.
32 IN PTR wee.voicense.com.
How To Load Balance A Web Server?
www IN A 10.0.0.1
www IN A 10.0.0.2
www IN A 10.0.0.3
How To Load Balance A Web Server?
$ host www.google.com
www.google.com is an alias for www.l.google.com.
www.l.google.com has address 74.125.19.104
www.l.google.com has address 74.125.19.103
www.l.google.com has address 74.125.19.147
www.l.google.com has address 74.125.19.99
$ host www.google.com
www.google.com is an alias for www.l.google.com.
www.l.google.com has address 74.125.19.99
www.l.google.com has address 74.125.19.104
www.l.google.com has address 74.125.19.103
www.l.google.com has address 74.125.19.147
Zone Transfer
dig
$ dig eon.cs.ucr.edu
$ dig eon.cs.ucr.edu ns
$ dig @momo.cs.ucr.edu eon.cs.ucr.edu mx
$ man dig
host
$ host eon.cs.ucr.edu
$ host -t ns cs.ucr.edu
$ host -t mx eon.cs.ucr.edu momo.cs.ucr.edu
$ man host
Tools (cont)
nslookup
$ nslookup eon.cs.ucr.edu
$ nslookup eon.cs.ucr.edu momo.cs.ucr.edu
whois
$ whois google.com
$ whois ucr.edu
/etc/resolv.conf
Resolver
$ cat /etc/resolv.conf
search cs.ucr.edu weesan.com
nameserver 138.23.169.10
nameserver 138.23.178.2
/etc/nsswitch.conf
Used by C library
gethostbyname()
$ cat /etc/nsswitch.conf
hosts: file nis dns
Reference
LAH
Ch 15: DNS – The Domain Name System