2004-04-29, 07:11 PM
(This post was last modified: 2009-07-27, 05:04 AM by Dungeon-Dave.)
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