Está en la página 1de 25

Domain Name Service (DNS) Configuration in Linux

DNS Names
DNS is a name resolution method.
Invented to overcome the problems with host files.

Hierarchical distributed database.


A domain name is a two (three) tier name. Administered centrally (eg InterNIC) Second part is a classification. Eg co First part identifies the organisation. Eg google

DNS Names
Last comes the country. Eg in Also referred to as top level domains (TLD)

DNS consists of thousands of servers.


Each contains its own part of the database.

Example
Hostname = mycomputer domain = google.co.in

How DNS Works


Remember, DNS is a hierarchical multi layered name space.
Dot (.) character is used as a separator between levels. Names farthest to the right (com,edu etc) are known as TLDs.
Used for broad classification.

Next are the registered domain names.


Eg google.

How DNS Works


Once a domain is registered, the organisation may subdivide it as they see fit.
Eg ece, cs, atri, csp etc

Few servers handle the TLDs


eg internic Known as root level servers.

How DNS Works


Once a domain is registered
Entries in your DNS zone file tell the servers how to respond to queries.
Authoritative or non authoritative.

How DNS Works

An Example
How an application uses DNS to resolve a name.
Looking up by entering the following in a browser.
http://www.google.co.in/default.html

http states the protocol to be used. www denotes what????? Default.html is the required document.

An Example
3 types of query are involved.
Client makes a recursive query to the local DNS. An iterative query- takes place between local and other DNS servers An inverse query. A client provides the IP and requests the Domain name in a reverse lookup

Zone Files
Zone files contain the information that tells the server how to respond to DNS queries.
Defines the servers zone of authority (SOA). Standard text file. Contains records for all nodes that the server is responsible for. Zones and domains are NOT the same!
Several servers (zone files) for one domain.

Zone Files
vi /var/named/chroot/var/named/munivel.com $TTL 1D @ IN

SOA

@ ;@ ns ;manoj www ftp mail pub man myman sw500

IN IN IN IN IN IN IN IN IN IN IN

NS MX A NS A CNAME CNAME CNAME CNAME CNAME CNAME

munivel.com. root.munivel.com. ( 4 1D 1H 1W 3H ) ns.munivel.com. 10 mail.munivel.com. 192.168.30.5 ns.manoj.munivel.com. 192.168.30.5 www www www www www www

NS, MX, A And CNAME Records

Resource records
Different resource records describe the type of node or service each entry represents.
Cname: An alias record.
www MX NS gw CNAME munivel 10 mail ; Primary Mail Exchanger

MX : Mail exchange record. NS : Name Server record.


ns.munivel.com. A 192.168.30.5 HINFO mylap TXT "The router"

A : A record

Resource Records
Every DNS server must contain a SOA record.
Always the first entry. Defines which entry is responsible from this point of the hierarchy down. Identifies:
The servername contact email (note the different form of email address.

Reverse Lookup Zone


Another type of zone file is the Reverse Lookup Zone.
Note that in an IP address;
Left portion is general. Right portion is specific.

Used when a client supplies the IP.


Opposite of domain names. The reverse zone file has reverse addresses.eg.
192.168.30 is entered as 30.168.192.in-addr.arpa All resource records are appended with in-addr.arpa A holdover from the original ARPAnet.

Reverse Lookup Zone


vi /var/named/chroot/var/named/munivel.com.rev

$TTL 1D @ IN SOA 30.168.192.in-addr.arpa. root.munivel.com. ( 0 1D 1H 1W ; serial ; refresh ; retry ; expire

3H ) ; minimum @ IN NS ns.munivel.com.

5 6

IN IN

PTR PTR PTR

www.munivel.com. ftp.munivel.com. www.manoj.munivel.com.

;100 IN

The SOA Record

NSLookup Utility
Available on most platforms. (NT,UNIX,Linux etc) Enables the querying of DNS servers. Two modes:
Batch Interactive

You will use this in the Lab. A very useful utility.

Checking Your Work


1. bash]# named-checkconf /etc/named.conf 2. bash]# named-checkzone -d munivel.com /var/named/data/munivel.com Output: loading munivel.com" from "/var/named/munivel.com" class "IN" zone munivel.com/IN: loaded serial 10 OK

Checking Your Work


1. named-checkzone -d 30.168.192.in-addr.arpa /var/named/data/munivel.com.rev Output: loading 30.168.192.in-addr.arpa" from "/var/named/data/munivel.com.rev" class "IN" zone 30.168.192.in-addr.arpa/IN: loaded serial 10 OK

Starting BIND
[bash]# chkconfig --level 2345 named on [bash]# /etc/init.d/named restart [bash]# chkconfig --list named [bash]# grep named /var/log/messages (Check the log message)

Testing The Server


[bash]# dig www.munivel.com ; <<>> DiG 9.5.1b2-RedHat-9.5.1-0.8.b2.fc10 <<>> www.munivel.com ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53127 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;www.munivel.com. IN A ;; ANSWER SECTION: www.munivel.com. ;; AUTHORITY SECTION: munivel.com. ;; ADDITIONAL SECTION: ns.munivel.com. ;; ;; ;; ;;

86400

IN

192.168.30.5

86400

IN

NS

ns.munivel.com.

86400

IN

192.168.30.5

Query time: 0 msec SERVER: 192.168.30.5#53(192.168.30.5) WHEN: Wed Dec 8 15:55:20 2010 MSG SIZE rcvd: 82

Testing The Server


[bash]# dig munivel.com AXFR 192.168.30.5 ; <<>> DiG 9.5.1b2-RedHat-9.5.1-0.8.b2.fc10 <<>> munivel.com AXFR 192.168.30.5 ;; global options: printcmd munivel.com. 86400 IN SOA munivel.com. root.munivel.com. 4 86400 3600 604800 10800 munivel.com. 86400 IN NS ns.munivel.com. ftp.munivel.com. 86400 IN CNAME www.munivel.com. mail.munivel.com. 86400 IN CNAME www.munivel.com. man.munivel.com. 86400 IN CNAME www.munivel.com. myman.munivel.com. 86400 IN CNAME www.munivel.com. ns.munivel.com. 86400 IN A 192.168.30.5 praf.munivel.com. 86400 IN CNAME www.munivel.com. pub.munivel.com. 86400 IN CNAME www.munivel.com. sw500.munivel.com. 86400 IN CNAME www.munivel.com. www.munivel.com. 86400 IN A 192.168.30.5 munivel.com. 86400 IN SOA munivel.com. root.munivel.com. 4 86400 3600 604800 10800 ;; Query time: 0 msec ;; SERVER: 192.168.30.5#53(192.168.30.5) ;; WHEN: Wed Dec 8 15:57:56 2010 ;; XFR size: 12 records (messages 1, bytes 291)

Testing The Server


[root@mail ~]# host 192.168.30.5 5.30.168.192.in-addr.arpa domain name pointer www.munivel.com.

End of DNS Class

También podría gustarte