DNS Server 1

Embed Size (px)

Citation preview

  • 8/13/2019 DNS Server 1

    1/25

    Domain Name Service (DNS)

    Configuration in Linux

  • 8/13/2019 DNS Server 1

    2/25

    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

  • 8/13/2019 DNS Server 1

    3/25

    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

  • 8/13/2019 DNS Server 1

    4/25

    How DNS Works

    Remember, DNS is a hierarchical multilayered 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.

  • 8/13/2019 DNS Server 1

    5/25

    How DNS Works

    Once a domain is registered, theorganisation 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.

  • 8/13/2019 DNS Server 1

    6/25

    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.

  • 8/13/2019 DNS Server 1

    7/25

    How DNS Works

  • 8/13/2019 DNS Server 1

    8/25

    An Example

    How an application uses DNS to resolve aname.

    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.

  • 8/13/2019 DNS Server 1

    9/25

    An Example

    3 types of query are involved.

    Client makes a recursive query to the local

    DNS.

    Aniterative

    query- takes place between localand other DNS servers

    An inverse query. A client provides the IP and

    requests the Domain name in a reverse lookup

  • 8/13/2019 DNS Server 1

    10/25

    Zone Files

    Zone files contain the information that tellsthe server how to respond to DNS queries.

    Defines the serverszone 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.

  • 8/13/2019 DNS Server 1

    11/25

    Zone Files

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

    $TTL 1D

    @ IN SOA munivel.com. root.munivel.com. (

    4

    1D

    1H

    1W

    3H )

    @ IN NS ns.munivel.com.

    ;@ IN MX 10 mail.munivel.com.

    ns IN A 192.168.30.5

    ;manoj IN NS ns.manoj.munivel.com.

    www IN A 192.168.30.5

    ftp IN CNAME wwwmail IN CNAME www

    pub IN CNAME www

    man IN CNAME www

    myman IN CNAME www

    sw500 IN CNAME www

  • 8/13/2019 DNS Server 1

    12/25

    NS, MX, A And CNAME Records

  • 8/13/2019 DNS Server 1

    13/25

    Resource records

    Different resource records describe the type of

    node or service each entry represents. Cname: An alias record.

    www CNAME munivel

    MX : Mail exchange record. MX 10 mail ; Primary Mail Exchanger

    NS : Name Server record. NS ns.munivel.com.

    A : A record gw A 192.168.30.5 HINFO mylap TXT "The router"

  • 8/13/2019 DNS Server 1

    14/25

    Resource Records

    Every DNS server must contain a SOA

    record.

    Always the first entry.

    Defines which entry is responsible from thispoint of the hierarchy down.

    Identifies: The servername contact email (note the different form of email

    address.

  • 8/13/2019 DNS Server 1

    15/25

    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.

  • 8/13/2019 DNS Server 1

    16/25

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

    $TTL 1D

    @ IN SOA 30.168.192.in-addr.arpa. root.munivel.com. (

    0 ; serial

    1D ; refresh

    1H ; retry

    1W ; expire

    3H ) ; minimum

    @ IN NS ns.munivel.com.

    5 IN PTR www.munivel.com.

    6 IN PTR ftp.munivel.com.

    ;100 IN PTR www.manoj.munivel.com.

    Reverse Lookup Zone

  • 8/13/2019 DNS Server 1

    17/25

    The SOA Record

  • 8/13/2019 DNS Server 1

    18/25

    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 usefulutility.

  • 8/13/2019 DNS Server 1

    19/25

    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

  • 8/13/2019 DNS Server 1

    20/25

    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

  • 8/13/2019 DNS Server 1

    21/25

    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)

  • 8/13/2019 DNS Server 1

    22/25

    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

  • 8/13/2019 DNS Server 1

    23/25

    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.5munivel.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)

  • 8/13/2019 DNS Server 1

    24/25

    [root@mail ~]# host 192.168.30.5

    5.30.168.192.in-addr.arpa domain name pointer www.munivel.com.

    Testing The Server

  • 8/13/2019 DNS Server 1

    25/25

    End of DNS Class