ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Magnum
                                                                                                          9850332133


                                  How To Configure DNS Server (RHEL-5)
Scenario 1 :

Create DNS Server on your machine based upon following information.

Information :

         1.       It should be resolve to localhost with recusrsion
         2.       Open Port No. 53 for you machine’s Lan Card
         3.       Disable IPV6 for Port No. 53
         4.       Create a zone file for your domain example.com as
                            station8.example.com                  as       A         192.168.100.8
                            station8.example.com                  as       MX        192.168.100.254
         5.       Also write zone file for abc.com to meet following requirements
         6.       Verify all the configuration with red hat tools provided in distribution of RHEL 5.


                                                                                                     Web : abc.com
                                                                                                     192.168.100.5
               Primary DNS           Secondary DNS                                                     Web : abc.com
              (Your Machine)         (Other Machine)                                                   192.168.100.6
               192.168.100.8         192.168.100.254
                  station8              station254                                                     MX-1 : abc.com
                                                                                                       172.16.0.5

                                                                       Infrastrcture of                MX-2 : abc.com
                                                                           abc.com                     apps.gmail.com

                                                                                                       chat.abc.com
                                                                                                       10.0.0.7
               You will be
              creating DNS
               Server Here


Solution :

Step 1 : Installation
         Install following packages in your machine using rpm or yum tool
                  #         rpm -ivh bind-9.3.3-7.el5.i386.rpm
                  #         rpm -ivh caching-nameserver-9.3.3-7.el5.i386.rpm
                  #         rpm -ivh bind-chroot-9.3.3-7.el5.i386.rpm


Magnum Net Solutions Pvt. Ltd.
25, Saikrupa Apt., Central Excise Colony, Ring Road, Chhatrapati Square, Nagpur 440015
Web Site : http://ax100.net Email : info@ax100.net Call : 9850332133 SMS : 9922000898
Magnum
                                                                                         9850332133


Step 2 : Start the DNS Server, verify it is working and setup your machine as client
         Start tne DNS server using service command and using chkconfig make it to run on
         runlevels 2 3 4 5 as below.
                  #         service named restart
                  #         chkconfig --level 2345 bind on
         Verify activity on Port No. 53
                  #         lsof -i :53




1.       It should be resolve to localhost with recusrsion

         By default reursion is set on for localhost. You can verify it from

         /var/named/chroot/etc/named.caching-nameserver.conf

         This file contains following block where recursion for localhost is set on.

         view localhost_resolver {
                match-clients { localhost; };
                match-destinations { localhost; };
                recursion yes;
             include "/etc/named.rfc1912.zones";
         };

2.       Open Port No. 53 for you machine’s Lan Card
         To do this you need to comment following lines in

         /var/named/chroot/etc/named.caching-nameserver.conf

         //    listen-on port 53 { 127.0.0.1; };

         //       view localhost_resolver {
         //              match-clients { localhost; };
         //              match-destinations { localhost; };

Magnum Net Solutions Pvt. Ltd.
25, Saikrupa Apt., Central Excise Colony, Ring Road, Chhatrapati Square, Nagpur 440015
Web Site : http://ax100.net Email : info@ax100.net Call : 9850332133 SMS : 9922000898
Magnum
                                                                                         9850332133


         //                        recursion yes;
         //              include "/etc/named.rfc1912.zones";
         //                 };

        By commenting       listen-on port 53 { 127.0.0.1; }; we are making the posrt 53 open to all
interfaces. If you want specific the you can do like this

                  listen-on port 53 { 127.0.0.1; 192.168.100.8;};

        We are also commenting the view localhost_resolver { } Block so that query can made from
interfaces other than localhost.

3.       Disable IPV6 for Port No. 53 :
         You can disable IPV6 query by commenting following lines in options block.
         //    listen-on-v6 port 53 { ::1; };
         //    query-source-v6 port 53;
         After making the changes, restart the named service and check using lsof command. It should
display following output.




         Also make sure comment and few more things to make this DNS server public.
         a]    Comment      allow-query { localhost; }; in options block
         b]    Add          recursion yes;        in options block
         c]    Also add     include "/etc/named.rfc1912.zones";        at the end of file.

Your final conf file (/var/named/chroot/etc/named.caching-nameserver.conf) should look like as
below.

options {
     directory       "/var/named";
     dump-file       "/var/named/data/cache_dump.db";
     statistics-file "/var/named/data/named_stats.txt";
     memstatistics-file "/var/named/data/named_mem_stats.txt";
     query-source    port 53;
     recursion yes;
};


Magnum Net Solutions Pvt. Ltd.
25, Saikrupa Apt., Central Excise Colony, Ring Road, Chhatrapati Square, Nagpur 440015
Web Site : http://ax100.net Email : info@ax100.net Call : 9850332133 SMS : 9922000898
Magnum
                                                                                                       9850332133



logging {
     channel default_debug {
           file "data/named.run";
           severity dynamic;
        };
};
include "/etc/named.rfc1912.zones";

4.       Create a zone file for your domain example.com as
                            station8.example.com                  as       A         192.168.100.8
                            station8.example.com                  as       MX        192.168.100.254
         For this purpose you need to edit              /var/named/chroot/etc/named.rfc1912.zones
         Add following block at the end of file and save it.


         zone "example.com" IN {
                  type master;
                  file "example.com.zone" ;
         };


         Now create /var/named/chroot/var/named/example.com.zone file and write as below.




         Now verify the syntax of /var/named/chroot/etc/named.rfc1912.zones by using following
command.
                  #         named-checkconf /var/named/chroot/etc/named.rfc1912.zones
         This should not produce any errors.

Magnum Net Solutions Pvt. Ltd.
25, Saikrupa Apt., Central Excise Colony, Ring Road, Chhatrapati Square, Nagpur 440015
Web Site : http://ax100.net Email : info@ax100.net Call : 9850332133 SMS : 9922000898
Magnum
                                                                                         9850332133


         Now verify the syntax of /var/named/chroot/var/named/example.com.zone by using follow-
ing command.
         #        named-checkzone example.com /var/named/chroot/var/named/example.com.zone
         This command will come up with following output, if there are no errors.
                  zone example.com/IN: loaded serial 2009012901
                  OK
         Now modify /etc/resolv.conf as below and point your DNS Client to your machine.




         Now check the DNS of example.com




         You can also use dig command to get complete answers.




Magnum Net Solutions Pvt. Ltd.
25, Saikrupa Apt., Central Excise Colony, Ring Road, Chhatrapati Square, Nagpur 440015
Web Site : http://ax100.net Email : info@ax100.net Call : 9850332133 SMS : 9922000898
Magnum
                                                                                              9850332133


5.       Also write zone file for abc.com to meet following requirements
         For this purpose you need to edit              /var/named/chroot/etc/named.rfc1912.zones
         Add following block at the end of file and save it.

         zone "abc.com" IN {
                  type master;
                  file "abc.com.zone" ;
         };

         Now create /var/named/chroot/var/named/abc.com.zone file and write as below.




         Now verify the syntax of /var/named/chroot/etc/named.rfc1912.zones
         #        named-checkconf /var/named/chroot/etc/named.rfc1912.zones
         Now verify the syntax of /var/named/chroot/var/named/example.com.zone
         #        named-checkzone example.com /var/named/chroot/var/named/example.com.zone

         Run following command to verify the DNS of abc.com




Magnum Net Solutions Pvt. Ltd.
25, Saikrupa Apt., Central Excise Colony, Ring Road, Chhatrapati Square, Nagpur 440015
Web Site : http://ax100.net Email : info@ax100.net Call : 9850332133 SMS : 9922000898

More Related Content

Dns configuration on rhel 5

  • 1. Magnum 9850332133 How To Configure DNS Server (RHEL-5) Scenario 1 : Create DNS Server on your machine based upon following information. Information : 1. It should be resolve to localhost with recusrsion 2. Open Port No. 53 for you machine’s Lan Card 3. Disable IPV6 for Port No. 53 4. Create a zone file for your domain example.com as station8.example.com as A 192.168.100.8 station8.example.com as MX 192.168.100.254 5. Also write zone file for abc.com to meet following requirements 6. Verify all the configuration with red hat tools provided in distribution of RHEL 5. Web : abc.com 192.168.100.5 Primary DNS Secondary DNS Web : abc.com (Your Machine) (Other Machine) 192.168.100.6 192.168.100.8 192.168.100.254 station8 station254 MX-1 : abc.com 172.16.0.5 Infrastrcture of MX-2 : abc.com abc.com apps.gmail.com chat.abc.com 10.0.0.7 You will be creating DNS Server Here Solution : Step 1 : Installation Install following packages in your machine using rpm or yum tool # rpm -ivh bind-9.3.3-7.el5.i386.rpm # rpm -ivh caching-nameserver-9.3.3-7.el5.i386.rpm # rpm -ivh bind-chroot-9.3.3-7.el5.i386.rpm Magnum Net Solutions Pvt. Ltd. 25, Saikrupa Apt., Central Excise Colony, Ring Road, Chhatrapati Square, Nagpur 440015 Web Site : http://ax100.net Email : info@ax100.net Call : 9850332133 SMS : 9922000898
  • 2. Magnum 9850332133 Step 2 : Start the DNS Server, verify it is working and setup your machine as client Start tne DNS server using service command and using chkconfig make it to run on runlevels 2 3 4 5 as below. # service named restart # chkconfig --level 2345 bind on Verify activity on Port No. 53 # lsof -i :53 1. It should be resolve to localhost with recusrsion By default reursion is set on for localhost. You can verify it from /var/named/chroot/etc/named.caching-nameserver.conf This file contains following block where recursion for localhost is set on. view localhost_resolver { match-clients { localhost; }; match-destinations { localhost; }; recursion yes; include "/etc/named.rfc1912.zones"; }; 2. Open Port No. 53 for you machine’s Lan Card To do this you need to comment following lines in /var/named/chroot/etc/named.caching-nameserver.conf // listen-on port 53 { 127.0.0.1; }; // view localhost_resolver { // match-clients { localhost; }; // match-destinations { localhost; }; Magnum Net Solutions Pvt. Ltd. 25, Saikrupa Apt., Central Excise Colony, Ring Road, Chhatrapati Square, Nagpur 440015 Web Site : http://ax100.net Email : info@ax100.net Call : 9850332133 SMS : 9922000898
  • 3. Magnum 9850332133 // recursion yes; // include "/etc/named.rfc1912.zones"; // }; By commenting listen-on port 53 { 127.0.0.1; }; we are making the posrt 53 open to all interfaces. If you want specific the you can do like this listen-on port 53 { 127.0.0.1; 192.168.100.8;}; We are also commenting the view localhost_resolver { } Block so that query can made from interfaces other than localhost. 3. Disable IPV6 for Port No. 53 : You can disable IPV6 query by commenting following lines in options block. // listen-on-v6 port 53 { ::1; }; // query-source-v6 port 53; After making the changes, restart the named service and check using lsof command. It should display following output. Also make sure comment and few more things to make this DNS server public. a] Comment allow-query { localhost; }; in options block b] Add recursion yes; in options block c] Also add include "/etc/named.rfc1912.zones"; at the end of file. Your final conf file (/var/named/chroot/etc/named.caching-nameserver.conf) should look like as below. options { directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; query-source port 53; recursion yes; }; Magnum Net Solutions Pvt. Ltd. 25, Saikrupa Apt., Central Excise Colony, Ring Road, Chhatrapati Square, Nagpur 440015 Web Site : http://ax100.net Email : info@ax100.net Call : 9850332133 SMS : 9922000898
  • 4. Magnum 9850332133 logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; include "/etc/named.rfc1912.zones"; 4. Create a zone file for your domain example.com as station8.example.com as A 192.168.100.8 station8.example.com as MX 192.168.100.254 For this purpose you need to edit /var/named/chroot/etc/named.rfc1912.zones Add following block at the end of file and save it. zone "example.com" IN { type master; file "example.com.zone" ; }; Now create /var/named/chroot/var/named/example.com.zone file and write as below. Now verify the syntax of /var/named/chroot/etc/named.rfc1912.zones by using following command. # named-checkconf /var/named/chroot/etc/named.rfc1912.zones This should not produce any errors. Magnum Net Solutions Pvt. Ltd. 25, Saikrupa Apt., Central Excise Colony, Ring Road, Chhatrapati Square, Nagpur 440015 Web Site : http://ax100.net Email : info@ax100.net Call : 9850332133 SMS : 9922000898
  • 5. Magnum 9850332133 Now verify the syntax of /var/named/chroot/var/named/example.com.zone by using follow- ing command. # named-checkzone example.com /var/named/chroot/var/named/example.com.zone This command will come up with following output, if there are no errors. zone example.com/IN: loaded serial 2009012901 OK Now modify /etc/resolv.conf as below and point your DNS Client to your machine. Now check the DNS of example.com You can also use dig command to get complete answers. Magnum Net Solutions Pvt. Ltd. 25, Saikrupa Apt., Central Excise Colony, Ring Road, Chhatrapati Square, Nagpur 440015 Web Site : http://ax100.net Email : info@ax100.net Call : 9850332133 SMS : 9922000898
  • 6. Magnum 9850332133 5. Also write zone file for abc.com to meet following requirements For this purpose you need to edit /var/named/chroot/etc/named.rfc1912.zones Add following block at the end of file and save it. zone "abc.com" IN { type master; file "abc.com.zone" ; }; Now create /var/named/chroot/var/named/abc.com.zone file and write as below. Now verify the syntax of /var/named/chroot/etc/named.rfc1912.zones # named-checkconf /var/named/chroot/etc/named.rfc1912.zones Now verify the syntax of /var/named/chroot/var/named/example.com.zone # named-checkzone example.com /var/named/chroot/var/named/example.com.zone Run following command to verify the DNS of abc.com Magnum Net Solutions Pvt. Ltd. 25, Saikrupa Apt., Central Excise Colony, Ring Road, Chhatrapati Square, Nagpur 440015 Web Site : http://ax100.net Email : info@ax100.net Call : 9850332133 SMS : 9922000898