• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4491
  • Last Modified:

Configure DNS Server on RHEL 4.0

Dear Experts,

I would be very much appreciated if someone could help me with a project I am planning to do. I want to manage my own DNS server rather then my ISP. Currently I am running Redhat Linux Enterprise Server 4.0 and I am hosting hosting ( Mail- Sendmail ) and (Web- Apache ) server for a comapny where I am working.  

Is it possible if I manage my own DNS record?  How would I start this project?

I had some experiences setting up Local DNS record on Redhat 8.0 before but there are some changes within RHEL 4.0 which leaded me to the confusion. I have read through the "named.conf" file but there are some (IPV6) record embed in there and I have not idea how to utilize IPV6...

I would like to thank you in advance for helping...
0
linxcelent
Asked:
linxcelent
  • 9
  • 9
1 Solution
 
paranoidcookieCommented:
You can ignore the ipv6 records simply add a zone declaration to you named.conf

One thing to note is that for correct DNS you should have a minimum of one slave server and that should be located on a physically seperate netblock.

zone "domain.co.uk" in {
        type master;
        file "domain.zone";
        allow-query {any;};
        notify yes;
};

Then create domain.zone file

$TTL 86400      ; 1 day
domain.co.uk.    IN      SOA     server.domain.co.uk. support.domain.co.uk. (
                        2004091201
                        21600
                        1800
                        5D
                        3600 )

nameserver           IN NS   alpha

server                    IN A    ipaddress
0
 
linxcelentAuthor Commented:
Thank you for a quick respond.

Let's see if I understand your command above correctely:  I have to have two physical server to run DNS server? or there is another way to setup DNS server utilizing one physical server.
0
 
paranoidcookieCommented:
You can run DNS from one server it is not recommended though.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
linxcelentAuthor Commented:
I don't have two physical server running right now.  I would like run DNS on one server just for now.  If this work out OK for me then I will try to get another server to run secondary DNS.  How would I configure DNS on one server?  Could you please give me some detail example?

Thank you
0
 
paranoidcookieCommented:
I have already given you pretty much the edits you have to make I would need to have the actual details of your server.

You will also need to have your isp / provider change the glue on at the top level domain to point dns querys at your server.
0
 
linxcelentAuthor Commented:
I guest I couldn't get away from bothering my ISP huh? :(
------------------------>>> Detail <<<------------------------------------
My server's netbios name is: mhost
My domain is: testdomain.com
My IP address: 64.248.xx.xxx

CNAMES:

mail    IN    CNAME    mhost.testdomain.com.
smtp   IN    CNAME    mhost.testdomain.com.
www   IN    CNAME    mhost.testdomain.com.
ftp      IN    CNAME    mhost.testdomain.com.
0
 
paranoidcookieCommented:
Certainly not unfortaunatly

Fire up your favorite text editor edit named.conf add the following zone definition

zone "mhost.testdomain.com" in {
        type master;
        file "testdomain.com.zone";
        allow-query {any;};
        notify yes;
};

Then create testdomain.com.zone file

$TTL 86400      ; 1 day
testdomain.com.    IN      SOA     testdomain.com. support.testdomain. (
                        2005031601
                        21600
                        1800
                        5D
                        3600 )

nameserver           IN NS   mhost

mhost                    IN A    64.248.xx.xxx

mail    IN    CNAME    mhost.testdomain.com.
smtp   IN    CNAME    mhost.testdomain.com.
www   IN    CNAME    mhost.testdomain.com.
ftp      IN    CNAME    mhost.testdomain.com.

Then restart bind check the error logs for messages grep named /var/log/messages

REMEMBER DNS is cached all over the interent it can take upto 3 full days for new settings to propogate!

0
 
linxcelentAuthor Commented:
Thank you for all your help, I would love to try the method above but my ISP is already hosted two domain names for me already.  

I wonder if I may ask you to help me setting up DNS for local mail only? Here is my named.conf file that I tried to setup for local DNS:

/etc/named.conf

//
// named.conf for Red Hat caching-nameserver
//

options {
      directory "/var/named";
      dump-file "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
      /*
       * If there is a firewall between you and nameservers you want
       * to talk to, you might need to uncomment the query-source
       * directive below.  Previous versions of BIND always asked
       * questions using port 53, but BIND 8.1 uses an unprivileged
       * port by default.
       */
      query-source address * port 53;
      listen-on { 127.0.0.1; 192.168.1.10; };
      forward only;
      forwarders { 64.248.xx.xxx; };
      allow-transfer { 192.168.1/24; };
      allow-query { 127.0.0.1; 192.168.1/24; };
};

//
// a caching only nameserver config
//
controls {
      inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};

zone "." IN {
      type hint;
      file "named.ca";
};

zone "localdomain" IN {
      type master;
      file "localdomain.zone";
      allow-update { none; };
};

zone "localhost" IN {
      type master;
      file "localhost.zone";
      allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
      type master;
      file "named.local";
      allow-update { none; };
};

zone "testdomain.com" IN {
      type master;
      file "testdomain.com.zone";
      allow-update { none; };
};

zone "1.168.192.in-addr-arpa" IN {
      type master;
      file "testdomain.com.rev";
      allow-update { none; };
};

# zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
#        type master;
#      file "named.ip6.local";
#      allow-update { none; };
# };

# zone "255.in-addr.arpa" IN {
#      type master;
#      file "named.broadcast";
#      allow-update { none; };
# };

# zone "0.in-addr.arpa" IN {
#      type master;
#      file "named.zero";
#      allow-update { none; };
# };

include "/etc/rndc.key";
0
 
paranoidcookieCommented:
Did you create the zone file /etc/named/testdomain.com.zone ? You need to add an MX (mailexchanger) record so

$TTL 86400      ; 1 day
testdomain.com.    IN      SOA     testdomain.com. support.testdomain. (
                        2005031602
                        21600
                        1800
                        5D
                        3600 )

testdomain.com      IN NS   mhost
testdomain.com      IN MX mhost

mhost                    IN A    64.248.xx.xxx

mail    IN    CNAME    mhost.testdomain.com.
smtp   IN    CNAME    mhost.testdomain.com.
www   IN    CNAME    mhost.testdomain.com.
ftp      IN    CNAME    mhost.testdomain.com.

This will only work for computers on yournetwork which use mhost for their dns
0
 
linxcelentAuthor Commented:
Yes, I created two zone files in /var/namd: testdomain.com.zone and testdomain.com.rev You said it should be in the /etc/named? There is no such directory in the /etc/named subfolder.
Here is my zone file look like:

# /var/named/testdomain.con.zone
$TTL 86400
@      IN SOA      mhost.testdomain.com. postmaster.testdomain.com. (
            2005031501      ; Serial
            10800            ; Refresh
            3600            ; Retry
            604800            ; Expire
            86400 )            ; Minimum
      IN NS      mhost.testdomain.com.
      IN MX      10 mhost.testdomain.com.
mhost      IN A      192.168.1.10
www      IN CNAME      mhost.testdomain.com.
mail      IN CNAME      mhost.testdomain.com.
smtp      IN CNAME      mhost.testdomain.com.

# /var/named/testdomain.com.rev
$TTL 86400
@      IN SOA      mhost.testdomain.com. postmaster.testdomain.com. (
            2005031501      ; Serial
            10800            ; Refresh
            3600            ; Retry
            604800            ; Expire
            86400 )            ; Minimum
      IN NS      mhost.testdomain.com.
1      IN PTR      mhost.testdomain.com.

After I created those two zone files I restarted "service named restart". The service replied with an OK which mean my dns is up and running.  But when I query the my Local domain name utilizing "dig www.testdomain.com", I got error reply like this:

; <<>> DiG 9.2.4 <<>> www.testdomain.com
;; global options: printcmd
;; connection time out; no servers could be reached

Please notice: This is for local dns only, only within the company use not out side world.


0
 
paranoidcookieCommented:
Sorry I meant /var/named/
0
 
linxcelentAuthor Commented:
After I created those two zone files I restarted "service named restart". The service replied with an OK which mean my dns is up and running.  But when I query the my Local domain name utilizing "dig www.testdomain.com", I got error reply like this:

; <<>> DiG 9.2.4 <<>> www.testdomain.com
;; global options: printcmd
;; connection time out; no servers could be reached

Please notice: This is for local dns only, only within the company use not out side world.
0
 
paranoidcookieCommented:
Can you check the message log for errors

grep named /var/log/messages (or /var/log/syslog cant remember which log red hats uses)
0
 
linxcelentAuthor Commented:
It's under  /var/log/messages
Here is the detail:

Mar 18 08:41:21 mhost named[4121]: starting BIND 9.2.4 -u named -t /var/named/chroot
Mar 18 08:41:21 mhost named[4121]: using 1 CPU
Mar 18 08:41:21 mhost named: named startup succeeded
Mar 18 08:41:21 mhost named[4121]: loading configuration from '/etc/named.conf'
Mar 18 08:41:21 mhost named[4121]: listening on IPv4 interface lo, 127.0.0.1#53
Mar 18 08:41:21 mhost named[4121]: listening on IPv4 interface eth0, 192.168.1.1#53
Mar 18 08:41:21 mhost named[4121]: command channel listening on 127.0.0.1#953
Mar 18 08:41:21 mhost named[4121]: zone 0.in-addr.arpa/IN: loaded serial 42
Mar 18 08:41:21 mhost named[4121]: zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
Mar 18 08:41:21 mhost named[4121]: zone 1.168.192.in-addr.arpa/IN: loaded serial 2005031801
Mar 18 08:41:21 mhost named[4121]: zone 255.in-addr.arpa/IN: loaded serial 42
Mar 18 08:41:21 mhost named[4121]: zone 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 1997022700
Mar 18 08:41:21 mhost named[4121]: zone testdomain.com/IN: loaded serial 2005031801
Mar 18 08:41:21 mhost named[4121]: zone localdomain/IN: loaded serial 42
Mar 18 08:41:21 mhost named[4121]: zone localhost/IN: loaded serial 42
Mar 18 08:41:21 mhost named[4121]: running
0
 
paranoidcookieCommented:
That all looks promising, so the fault must be elsewhere. Check your /etc/resolv.conf and /etc/nsswitch.conf your server should be using itself as a dns host.

Test what nameserversthe client computers are configured to look at.

On the server itself try ping mhost.testdomain.com

if that works try ping www.testdomain.com

Then try it on the clinets

0
 
linxcelentAuthor Commented:
Oh, I know what is wrong now. I forgot to change my DNS record to private ip address... Let me try that and I'll let you know how thing goes...

By the way, What does the /etc/nsswitch.com do?
0
 
paranoidcookieCommented:
Several things but it determines the order of dns lookup useually

files hosts dns

Meaing it adns request will look at systems files then /etc/hosts then use dns to do a lookup.
0
 
linxcelentAuthor Commented:
I changed my DNS setting to my private IP address instead of public IP address. Now it's working just fine.

Thank you for all your help...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 9
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now