LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-03-2011, 02:21 AM   #1
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Rep: Reputation: Disabled
DNS server


hello everyone,

I want to set up dns server in my centos distro.i have installed bind but named.conf and rndc.conf is not there is any of the directories. Instead named.caching-nameserver.conf,named.rfc1912.zones and rndc.key is present in the /etc directory...what are they?

are they equivalent to named.conf and rndc.conf or do i need to create them?
if so where do i have to create them?please help me..
 
Old 10-03-2011, 03:44 AM   #2
zackwasa
Member
 
Registered: Sep 2011
Posts: 52

Rep: Reputation: Disabled
What OS do you have?

RMI

Last edited by zackwasa; 01-12-2012 at 02:11 AM.
 
Old 10-03-2011, 04:48 AM   #3
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
well i have centos 5.6 installed and the bind version is 9.3.6...named.conf and rndc.conf files are missing..
 
Old 10-03-2011, 07:21 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,602

Rep: Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532Reputation: 1532
Hi,

You can find a sample named.conf in /usr/share/doc/bind-9.3.6/sample/etc/named.conf, but I suggest you to read a howto (you may try this) to setup bind.
You can also install system-config bind and use its gui if you feel more comfortable with it

Regards
 
Old 10-03-2011, 07:37 AM   #5
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
well i have installed bind with chroot....i dont understand whether it's because of the centos and bind version that i am using is causing this problem or what is that...

or should i install caching name server and rename it as named.conf?please help me,i dont find the configuration files in both /etc and /var directory though it is supposed to be there...
 
Old 10-03-2011, 07:55 AM   #6
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,194
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
When you install a bind package all its configuration files are not stored in /etc by default. So, you need to copy all the files and arrange them in /etc.


To get the default location use this command

Code:
#rpm -ql bind
or for accurate information of relative package
Code:
#rpm -qa | grep bind
and then
Code:
#rpm -ql (name of the package)
The named.caching nameserver file you are talking about can also work as named.conf.

here are the configuration step which you need to follow

Code:
#cp /usr/share/doc/bind-9.3.6/sample/etc/* /var/name/chroot/etc/

#cp /usr/share/doc/bind-9.3.6/sample/var/named/* /var/name/chroot/var/named/

#cp /usr/share/doc/bind-9.3.6/sample/var/named/slaves/* /var/name/chroot/var/named/slaves/
Now you need to regenerate the named.conf file.

So,

Code:
# cd /var/named/chroot/etc/

#cp named.caching-nameserver named.conf

#vi named.conf
You will also need to edit the
Code:
named.rfc1912.zones

If you require any help with the configuration of these files then let me know as you have mentioned your current issue is missing named.conf
 
1 members found this post helpful.
Old 10-04-2011, 12:45 AM   #7
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
thanks deepak...

i used the rpm -ql bind command and it showed the directories for files but it showed named.conf file in the /etc directory but when i went to that directory it was missing and rndc.conf is missing as well...

well named.caching-nameserver.conf is present because i installed caching nameserver so is it advisable to use it as named.conf file?

and ya as you said your help and guidance in configuring these files would be highly appreciated and helpful....i wanna run name servers so..
 
Old 10-04-2011, 01:45 AM   #8
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,194
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
Well as I said by default the named.conf file is never installed in the /etc folder

I had given you the default location, you need to copy from there

As far as named.caching-nameserver is concerned, that is the one of the main file for configuration

So I would suggest you to simply copy that file in the /etc folder

Code:
#cp named.caching-nameserver /etc/named.conf

This will create your named.conf file


Before we start with configuration there are few changes which will be required

check the hostname of your system
For example mine is server.example.com

Then go for the ifcfg-eth0 file
Code:
#cd /etc/sysconfig/network-scripts/ifcfg-eth0
and change the peerdns=no
add your IP in your hosts file and resolv.conf file

Code:
#vi /etc/hosts
192.168.0.X hostname

#vi /etc/resolv.conf
nameserver 192.168.0.X your machines IP

Now as for the configuration, It depends on you whether you want to configure the files in /etc and /var/named or /var/named/chroot/etc and /var/named/chroot/etc


For now I will take the /var/named/chroot/etc folder

Code:
#cd /var/named/chroot/etc/
Code:
#vi named.conf
 listen-on port 53 { 127.0.0.1; 192.168.0.233; }; (instead of 233 mention your ip)
allow-query     { localhost; 192.168.0.0/24;};
view localhost_resolver {
        match-clients      { localhost; 192.168.0.0/24; };
        match-destinations { localhost; 192.168.0.0/24; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};
(make the following changes in relative lines)

Now as per the named.conf file you need to edit named.rfc1912.zones

Code:
#vi named.rfc1912.zones
zone "example.com" IN {
        type master;
        file "example.com.zone";
        allow-update {none;};
};

zone "0.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.0.zone";
        allow-update{none;};
};
(add these lines as per the domain name you want for forward and reverse zone. If you find any issue then you can refer to other lines present in the config file for reference)

Now you need to create entries in /var/named/chroot/var/named of the forward and reverse zones you mentioned in named.rfc1912.zones
Code:
#cd /var/named/chroot/var/named

#cp named.local 192.168.0.zone
#cp localhost.zone example.com.zone
this will create your forward and reverse lookup zone

Now you need to edit the file as per you

Code:
#vi example.com.zone
$TTL    86400
@               IN SOA  server.example.com.       root.estuate.com. (
                                        52              ; serial
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                IN NS           server.example.com.
                IN MX           10 server.example.com.

server          IN A            192.168.0.233
www             IN A            192.168.0.233
ftp             IN A            192.168.0.233
mail            IN CNAME        mail.example.com

Code:
#vi 192.168.0.zone
$TTL    86400
@       IN      SOA     server.example.com.    root.server.example.com.  (
                                      1997022703 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      server.example.com.
233     IN      PTR     server.example.com.
Thats it with your configuration files and if everything goes well you will be able to restart your server very fine
Code:
#service named restart

If you get any error then let me know
Best of Luck

Last edited by deep27ak; 10-04-2011 at 01:56 AM.
 
1 members found this post helpful.
Old 10-04-2011, 02:08 AM   #9
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
thanks deepak,will do as u said...thanks a lot for ur help...will again get back to you if a get any errors..

but you know i have one doubt and that is i have found one named.conf file in cd /usr/share/doc/bind-9.3.6/sample/etc/...i dont know if it's the correct one and looks like :
//
// Sample named.conf BIND DNS server 'named' configuration file
// for the Red Hat BIND distribution.
//
// See the BIND Administrator's Reference Manual (ARM) for details, in:
// file:///usr/share/doc/bind-*/arm/Bv9ARM.html
// Also see the BIND Configuration GUI : /usr/bin/system-config-bind and
// its manual.
//
options
{
// Those options should be used carefully because they disable port
// randomization
// query-source port 53;
// query-source-v6 port 53;

// Put files that named is allowed to write in the data/ directory:
directory "/var/named"; // the default
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
memstatistics-file "data/named_mem_stats.txt";

};
logging
{
/* If you want to enable debugging, eg. using the 'rndc trace' command,
* named will try to write the 'named.run' file in the $directory (/var/named).
* By default, SELinux policy does not allow named to modify the /var/named directory,
* so put the default debug log file in data/ :
*/
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
//
// All BIND 9 zones are in a "view", which allow different zones to be served
// to different types of client addresses, and for options to be set for groups
// of zones.
//
// By default, if named.conf contains no "view" clauses, all zones are in the
// "default" view, which matches all clients.
//
// If named.conf contains any "view" clause, then all zones MUST be in a view;
// so it is recommended to start off using views to avoid having to restructure
// your configuration files in the future.
//
view "localhost_resolver"
{
/* This view sets up named to be a localhost resolver ( caching only nameserver ).
* If all you want is a caching-only nameserver, then you need only define this view:
*/
match-clients { localhost; };
match-destinations { localhost; };
recursion yes;
# all views must contain the root hints zone:
include "/etc/named.root.hints";

/* these are zones that contain definitions for all the localhost
* names and addresses, as recommended in RFC1912 - these names should
* ONLY be served to localhost clients:
*/
include "/etc/named.rfc1912.zones";
};
view "internal"
{
/* This view will contain zones you want to serve only to "internal" clients
that connect via your directly attached LAN interfaces - "localnets" .
*/
match-clients { localnets; };
match-destinations { localnets; };
recursion yes;
// all views must contain the root hints zone:
include "/etc/named.root.hints";

// include "named.rfc1912.zones";
// you should not serve your rfc1912 names to non-localhost clients.

// These are your "authoritative" internal zones, and would probably
// also be included in the "localhost_resolver" view above :

zone "my.internal.zone" {
type master;
file "my.internal.zone.db";
};
zone "my.slave.internal.zone" {
type slave;
file "slaves/my.slave.internal.zone.db";
masters { /* put master nameserver IPs here */ 127.0.0.1; } ;
// put slave zones in the slaves/ directory so named can update them
};
zone "my.ddns.internal.zone" {
type master;
allow-update { key ddns_key; };
file "slaves/my.ddns.internal.zone.db";
// put dynamically updateable zones in the slaves/ directory so named can update them
};
};
key ddns_key
{
algorithm hmac-md5;
secret "use /usr/sbin/dns-keygen to generate TSIG keys";
};
view "external"
{
/* This view will contain zones you want to serve only to "external" clients
* that have addresses that are not on your directly attached LAN interface subnets:
*/
match-clients { any; };
match-destinations { any; };

recursion no;
// you'd probably want to deny recursion to external clients, so you don't
// end up providing free DNS service to all takers

allow-query-cache { none; };
// Disable lookups for any cached data and root hints

// all views must contain the root hints zone:
include "/etc/named.root.hints";

// These are your "authoritative" external zones, and would probably
// contain entries for just your web and mail servers:

zone "my.external.zone" {
type master;
file "my.external.zone.db";
};
};


so shall i edit this or use the named.caching-nameserver and rename it as named.conf????
 
Old 10-04-2011, 05:15 AM   #10
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,194
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
Ya I had told yo by default the named.conf is saved in
Code:
/usr/share/doc/bind-9.3.6/sample/etc/
Well as for your question you can work any ways.If you give a good look and compare named.caching-nameserver and named.conf with named.rdc1912.zone, both of them will be quite same.

If you use the named.conf file in the mentioned directory then the configuration will be different

Well you can choose any one of the option.

If you want to edit your named.conf file from
Code:
/usr/share/doc/bind-9.3.6/sample/etc/
then follow these steps

look out for these lines in the file and comment them as I have done because it will ask you to generate ddns key which is not required.

Code:
#key ddns_key
#{
#algorithm hmac-md5;
#secret "use /usr/sbin/dns-keygen to generate TSIG keys";
#};

and the zone entries is also supposed to be done in the same file instead of named.rfc1912.zone

Rest everything I explained will be same.

So, you can choose for either way.
Well I opted for named.caching-nameserver because I Find that less complicated then the original named.conf

I will advise you to take a backup of every configuration file you touch to be safe in future.

Last edited by deep27ak; 10-04-2011 at 05:18 AM.
 
1 members found this post helpful.
Old 10-04-2011, 05:44 AM   #11
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
hey thanks a million....
...will again get back to u if i have any doubts ok.please don't mind me asking u again and again..
 
Old 10-04-2011, 05:46 AM   #12
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,194
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
not at all

even I am learning this way
 
Old 10-05-2011, 01:47 AM   #13
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
deepak i again need your help.....

i copied the caching-nameserver file to the /etc directory as u said which created named.conf file as you said but when i went to /etc/sysconfig/network-scripts/,ifcfg-eth0 was not having any option to change the peer dns...it had:

# Intel Corporation 82566DM Gigabit Network Connection
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:1C:C4:9B:29:0C
ONBOOT=yes

so this is what it displayed...can you please help me??
 
Old 10-05-2011, 02:16 AM   #14
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,194
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
There is no option for peerdns because it seems that you are using DHCP server for your machine so no issues continue the same way or if you can provide a static ip then you will have to mention the peerdns option

If you want you can use this format



Code:
DEVICE=eth0
BOOTPROTO=none
HOSTNAME=server.example.com
HWADDR=x:x:x:x:x
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=no
NETMASK=255.255.255.0
IPADDR=192.168.0.XXX
GATEWAY=192.168.0.X


or you can simply create a new entry in your ifcfg-eth0 file

Code:
PEERDNS=no


you can opt for either option

Last edited by deep27ak; 10-05-2011 at 02:18 AM.
 
1 members found this post helpful.
Old 10-05-2011, 02:25 AM   #15
SarahGurung
Member
 
Registered: Jul 2011
Posts: 322

Original Poster
Rep: Reputation: Disabled
yes i am using DHCP instead of static ip addresses....and i want to continue that way..

that means which step should i follow??the first one or the second one,i didn't understand your answers clearly,please don't mind and thanks once again....you are really helping me..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
help needed to setup a DNS server can anyone say how to configure a DNS server subha Linux - Networking 4 04-28-2012 12:50 AM
how to configure another dns server to combine use with primary current dns server. hocheetiong Linux - Newbie 1 05-29-2008 07:57 PM
LXer: Find out DNS Server Version With DNS Server Fingerprinting Tool LXer Syndicated Linux News 0 12-21-2007 06:30 PM
LXer: Find out DNS Server Version With DNS Server Fingeprinting Tool LXer Syndicated Linux News 0 12-21-2007 05:50 PM


All times are GMT -5. The time now is 11:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration