Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
setting up DNS
#1

First.. these are the rpms you need installed

 



Code:
bind
bind-utils
caching-nameserver




 

as you can see we are going to install a caching nameserver. This is the most straight foward type of DNS install.. very very easy. The hard part is figuring out the config and what all those and letters and dots mean and what should go where. Also this will not cover reverse.. most people don't need it.. if people want a reverse section i will add it

 

Most people complain that they don't have a /etc/named.conf when they have bind installed. Well named.conf is included in the caching nameserver package.

 

ok so now on to the install. For this install we shall setup a domain called jyrules.com. If anyone wants to buy me this it'll be glad to take it <img src="https://www.linux-noob.com/forums/public/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=" :)" border="0" alt="smile.gif" />

 

ok so now we edit the /etc/named.conf file

 

you will see other entries for the localhost. We want to keep these. so at the bottom add this

 

 



Code:
zone "jyrules.com" {
       type master;
       file "jyrules.com";
};




 

So the zone is the name of the domain. and the file is the file in /var/named i call it the domain also you can call the file whatever you want.

 

Now lets create that zone file.. so edit a new file called /var/named/jyrules.com

 

and lets add all this into it

 



Code:
@               IN      SOA     ns1.jyrules.com. admin.jyrules.com. (
                               2004042801      ; Serial
                             2H       ; Refresh
                             2H       ; Retry
                             1H       ; Expire
                             1D)      ; Min TTL

                       NS      ns1.jyrules.com.
                       NS      ns2.jyrules.com.
                       NS      ns.domain.com.

jyrules.com.           MX      5 mail.jyrules.com.
jyrules.com.           MX      15 pvr.jyrules.com.

jyrules.com.           A       66.143.31.24

localhost               A       127.0.0.1

www                             CNAME   jyrules.com.
ftp                             CNAME   jyrules.com.
mail                            CNAME   jyrules.com.
ns1                             CNAME   jyrules.com.
ns2                             CNAME   jyrules.com.

pvr                   IN      A       24.194.246.98




 

ok so the first line is the SOA. I won't go into much here but just the things to change. This is THE MOST confusing part of DNS is seems. The ns1.jyrules.com means this is the main nameserver for this domain. The admin.jyrules.com reads like admin@jyrules.com this is the contact for the dns of the domain.

 

Everytime you change your dns records.. you should change the serial number for it. This helps other servers refresh your domain so they aren't caching bad info. i do it like <year><month><day><hour>

 

so the next lines specifiy what nameservers control this domain. I have two setup that are within my domain and one that is outside my network.

 

The next line tells email servers which IP to send email to for a domain. mail is my primary mailserver and pvr is my secondary. It knows this my the numbers (5 and 15) whichever is lower is the primary. You can have 10 of them listed.. it will just start at the lowest and move up. So if the first 2 are down it'll go to the 3rd.

 

my next two lines assign a name to an IP. You should only have one name assigned to an IP. THen you can use aliases after that. I always bind the domain to the main ip.

 

Then come the aliases which are identified by the cnames. So that says if www.jyrules.com is accessed check the ip for jyrules.com. You can have a ton of these if you want.

 

Then my last line is another A record that gets pointed to a IP outside. This is my mythtv box.

 

Now save the file, and run the following commands

 



Code:
chkconfig named on
service named start




This ensures bind is started on bootup and then starts bind.

 

You can check your /var/log/messages file and you should get something like this

 



Code:
Apr 29 15:09:20 pvr named[4316]: loading configuration from '/etc/named.conf'
Apr 29 15:09:20 pvr named[4316]: no IPv6 interfaces found
Apr 29 15:09:20 pvr named[4316]: listening on IPv4 interface lo, 127.0.0.1#53
Apr 29 15:09:20 pvr named[4316]: listening on IPv4 interface eth0, 192.168.1.100#53
Apr 29 15:09:20 pvr named[4316]: command channel listening on 127.0.0.1#953
Apr 29 15:09:20 pvr named[4316]: zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
Apr 29 15:09:20 pvr named[4316]: jyrules.com:1: no TTL specified; using SOA MINTTL instead
Apr 29 15:09:20 pvr named[4316]: zone jyrules.com/IN: loaded serial 2004042801
Apr 29 15:09:20 pvr named[4316]: zone localhost/IN: loaded serial 42
Apr 29 15:09:20 pvr named[4316]: running
Apr 29 15:09:20 pvr named[4316]: zone jyrules.com/IN: sending notifies (serial 2004042801)




 

Yay.. it loaded the zone and its running. Now we can change the /etc/resolv.conf to point to 127.0.0.1

 



Code:
nameserver 127.0.0.1




 

If you have others listed add that one to the top. so it gets run first. Now we can debug our domain locally to see if everything is up and running

 



Code:
[root@pvr log]# nslookup jyrules.com
Note:  nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead.  Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
Server:         127.0.0.1
Address:        127.0.0.1#53

Name:   jyrules.com
Address: 66.143.31.24

[root@pvr log]# nslookup mail.jyrules.com
Note:  nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead.  Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
Server:         127.0.0.1
Address:        127.0.0.1#53

mail.jyrules.com        canonical name = jyrules.com.
Name:   jyrules.com
Address: 66.143.31.24




 

 

There ya go.. looks like bind is up and running. If you have a firewall in front.. make sure port 53 tcp/udp can get through.

 

another one from the great J to the Y

Reply
#2

I need bind to listen on my ipv6 enterface but it wouldn't listen on any. as you can see in your /var/log/messages

Quote:Apr 29 15:09:20 pvr named[4316]: no IPv6 interfaces found
I don't get anything like that, here's my log
Code:
Jun 29 01:00:27 seeno named[32165]: starting BIND 9.2.1 -u named
Jun 29 01:00:27 seeno named[32165]: using 1 CPU
Jun 29 01:00:27 seeno named[32165]: loading configuration from '/etc/named.conf'
Jun 29 01:00:27 seeno named[32165]: listening on IPv4 interface lo, 127.0.0.1#53
Jun 29 01:00:27 seeno named[32165]: listening on IPv4 interface eth0, 10.0.0.5#53
Jun 29 01:00:27 seeno named[32165]: command channel listening on 127.0.0.1#953
Jun 29 01:00:27 seeno named[32165]: zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
Jun 29 01:00:27 seeno named[32165]: zone 3.0.f.0.0.c.b.0.e.f.f.3.ip6.int/IN: loaded serial 2004062823
Jun 29 01:00:27 seeno named[32165]: zone localhost/IN: loaded serial 42
Jun 29 01:00:27 seeno named[32165]: seeno.net:1: no TTL specified; using SOA MINTTL instead
Jun 29 01:00:27 seeno named[32165]: zone seeno.net/IN: loaded serial 2004062610
Jun 29 01:00:27 seeno named[32165]: running
Jun 29 01:00:27 seeno named: named startup succeeded


I'm running bind-9.2.1-16, I guess this is the default included package in redhat9, unless i upgraded it using apt-get. Is there a way I could get it to listen on my ipv6 interfaces?

 

Thanks :)

Reply
#3

try added this into your named.conf

 

listen-on-v6 {any;};

Reply
#4
Yay, another score for linux-noob. I've been looking for a simple explaination of how DNS/BIND works, and.... well thanks Jy.
Reply
#5

So.. in this setup,

 

"66.143.31.24" is your public, outside ip address? or is "24.194.246.98"

 

 

I am 100% dns naive..

 

 

Here's my understanding, and feel free to tell me if I am wrong.

 

Every dns server basically cascades every other dns server.

 

It would be best, of course, if I have a static IP address to my machine at my location. Assuming I do, and this information is true..

 

Here is the information about my current internet connection [cable modem] info as reported to my router, all these ips are obviously given to my router by the cable modem.

 

IP Address 68.205.12.23

 

Subnet Mask 255.255.248.0

 

Default Gateway 68.205.120.1

 

DNS (of my isp)

24.95.227.39

24.95.227.40

65.32.1.79

 

 

 

 

How would these numbers apply to me.

 

Additionally.. how would I go about getting the internet to know that my domain is actually at my ip address. - I am guessing I can update my registrar to point to the name servers of mydomain.com to 68.205.12.23

 

I'm confused .. :-)

Reply
#6

sorry i just noticed this reply.

 

Ok 66.143.31.24 is my main server on my lan.. the other 24 is like my home computer or such i want to give a subdomain to.

 

All dns does is make it easy for us so we don't have to memorize ip addresses. So a A name just says this hostname.. send it to this IP address. a Cname is like an alias to a A record. So I can have a million different IPs all in one dns zone

Reply
#7
Ok, I setup that and rebooted, but my box still has the cronical hostname off "193.227.247.215.247.227.193.in-addr.arpa" And i cant get my server to run as a dns server im screwed:-p
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)