We help IT Professionals succeed at work.

CentOS server DNS

_3mp3ror_
_3mp3ror_ asked
on
I am trying to figure out how to make a new server up and running for the first time.
I got it already installed with centos 5.5 64bit and xampp

the domain name is already bought, and on the server I have already a static ip address but I don't really quite know why I can't make the connection with name <=> ip.
here are my config files:

resolv.conf
---------------------------
webhosting company's nameserver

nameserver 5.6.7.8
nameserver 6.7.8.9

Open in new window



ifconfig
---------------------------

bond0     Link encap:Ethernet  HWaddr 
          inet addr:1.2.3.4  Bcast:1.2.3.255  Mask:255.255.255.0
          inet6 addr:  Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:139946968 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13486554 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:29338819024 (27.3 GiB)  TX bytes:18510804055 (17.2 GiB)

bond0:1   Link encap:Ethernet  HWaddr
          inet addr:1.2.3.5  Bcast:1.2.3.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

bond0:2   Link encap:Ethernet  HWaddr 
          inet addr:1.2.3.6  Bcast:1.2.3.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

eth0      Link encap:Ethernet  HWaddr
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:82587831 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13486549 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:25495735389 (23.7 GiB)  TX bytes:18510803677 (17.2 GiB)
          Interrupt:169 Memory:da000000-da012800

eth1      Link encap:Ethernet  HWaddr
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:57359137 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3843083635 (3.5 GiB)  TX bytes:378 (378.0 b)
          Interrupt:225 Memory:dc000000-dc012800

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:10314 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10314 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:523463 (511.1 KiB)  TX bytes:523463 (511.1 KiB)

Open in new window


/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;
};

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

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

zone "mydomainname.abc" IN {
   type master;
   file "/var/named/mydomainname.abc.zone";
   allow-update { none; };
};

zone "7.6.5.in-addr.arpa" IN {
   type master;
   file "/var/named/7.6.5.rev";
   allow-update { none; };
};

include "/etc/rndc.key";

Open in new window


var/named/7.6.5.rev
---------------------------

$TTL    86400
@       IN      SOA     mydomainname.abc. root.mydomainname.abc (
100     ; serial
1H      ; refresh
1M      ; retry
1W      ; expiry
1D)     ; minimum
@       IN      NS      ns1.mydomainname.abc.
1       IN      PTR     binggo.mydomainname.abc.

Open in new window


var/named/mydomainname.abc.zone
---------------------------

$TTL            86400
@       IN      SOA            mydomainname.abc.  root.mydomainname.abc. (
100                             ; serial
1H                              ; refresh
1M                              ; retry
1W                              ; expiry
1D )                            ; minimum
@       IN      NS             ns1.mydomainname.abc
@       IN      A                 5.6.7.8
ns1     IN      A                 5.6.7.8
@       IN      MX      10      mail.mydomainname.abc.
mail    IN      A                 5.6.7.8
WWW     IN      A                 5.6.7.8

Open in new window


When I do nslookup i get
nslookup mydomainname.abc
Server:         5.6.7.8
Address:       5.6.7.8#53

** server can't find mydomainname.abc: NXDOMAIN

Open in new window

and dig

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> mydomainname.abc
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 28303
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
mydomainname.abc.                 IN      A

;; Query time: 8 msec
;; SERVER: 5.6.7.8#53(5.6.7.8)
;; WHEN: Tue Jun 15 19:43:08 2010
;; MSG SIZE  rcvd: 31

Open in new window


I am new to this kind of thing so explain to me why it's not working properly and what do I need to do to make it work.

Thanks.
Comment
Watch Question

Commented:
if an nslookup is not resolving the IP, the issue is with dns and not with any config in centOS.

You need to make sure that you have the domain name pointing to a DNS with a record of that domain name. When you regester a Domain you can specify the DNS servers, if you do not it will usually default to the registrars parking servers. The DNS servers then need to point to your IP.  There are several free DNS services such as zoneedit you can use if the registrar does not provide one.

Author

Commented:
hi Torghn, thanks for your feedback, indeed when i registered the domain i can manage my name-servers (see picture attached) and entered the name-servers from the web-hosting company, named them ns1.mydomainname.abc and ns2.mydomainname.abc and the ip's from what the hosting gave me.
you also said that The DNS servers then need to point to your IP, but I don't know how to do that since the name-servers are from the web-hosting company and I only have access to my own server.

nameservers.PNG
Commented:
The DNS servers can't be the same as the domain, there would be no way to resolve either. They need to point to an existing DNS server. Your webhost should provice DNS servers that are seperate from your domain ie NS1.webhost.com and NS2.webhost.com.  If they do not you can sign up for a free dns else where. I personaly use zoneedit.  Once you have the domain pointing to valid DNS you'll need to configure the DNS to point to your IP.

Author

Commented:
I think I get it, so the only way to find the the IP of the names ns1 and ns2 is to actually have another dns that resolves those two.
and I think that I need this since from the registrar I can only add name-servers tied to my domain.
When they gave me the infos about the server they gave me these two so I just assumed that I could name them ns1.bla.com and ns2.bla.com and would work
I will take a look at zoneedit now
thanks

Author

Commented:
and I think that I need this since from the registrar I can only add name-servers tied to my domain.
scratch that I just added the name-servers from zone edit into the registrar.

pretty nice service, straightforward
now I just change the IP's of the NS's in the server from resolv.conf or do I append to resolv.conf ?

Commented:
you don't have to change resolv.conf, but you can. If you've added your domain and correct IP to zoneedit, you just need to updated the registrar to point to thoes new name servers (ns#.zoneedit.com).  That part can take a few days to propagate, but once that's done your domain will point to your servers IP.

Author

Commented:
I missed the adding the ip part, it says name.domain.abc and IP 
what should be used in the name part ?

Commented:
1. Create an account at zoneedit, in your account and a zone for your domain, create an A record for that domain pointing to your servers current IP address.
2. during step 1 you will get 2 DNS servers to enter into your regestar they will be ns#.zoneedit.com.
3. Wait for the dns to propigage, this can take in excess of 24 hours.
4. yourdoman.abc will point to the correct IP

Author

Commented:
Before asking here I was trying to use this tutorial.
http://www.howtoforge.com/bind-installation-on-centos
Thanks for your patience.

Commented:
Bind is made for setting up your own DNS server, most commonly used inside an internal network. You could set up you own dns instead of using a service like zoneedit, but then your domain would be dependent on your bind server being up.  If all you want to do is point your domain name to your IP, using bind would be a difficult and cumbersome way of ding it.

Author

Commented:
Aha I see now.
Right now it's just one server but there will be 3-5 servers in a short time (3-4 months) 
When would be worth it (in your opinion) to use BIND, on a local machine instead of a service like zoneedit ?

Commented:
You'd have to have thousands of servers to be worth the cost of running your own external DNS.

Author

Commented:
Thanks for your patience.