LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-01-2011, 07:25 PM   #1
gsm113
LQ Newbie
 
Registered: Aug 2011
Posts: 6

Rep: Reputation: Disabled
Trouble setting up DNS and DHCP


I've followed a few youtube videos and written tutorials on the subject but I must be doing something wrong in the configurations because after I activate both servers, renew ip on another computer on the same network, I cannot access webpages anymore. I get an error message that there is an error with DNS. Strangely enough, google domains work fine, just a bit slow.

Is there any way to troubleshoot and see exactly where the problem is? Both servers show as running normally.

I am using CentOS version 5.6, and activating both servers through webmin.

Admittedly I am rather new to setting up servers and linux in general, but would appreciate any help.
Thanks.
 
Old 09-02-2011, 01:58 AM   #2
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Debian
Posts: 202

Rep: Reputation: 36
First I would check what in the client PC what DNS have been assigned by DHCP. If the server is correct, then obviously the problem is in the DNS server, otherwise check that you have the option domain-name-servers your.dns.ipin the correct subnect section of the /etc/dhcp/dhcpd.conf. You can also add a log-facility to get logs of your DHCP server. Do a man dhcpd.conf to learn about that configuration file.

If the problem is your DNS... well there could be a number of issues, first check if you have a logging section in your /etc/bind/dhcpd.conf and try to find the problem, I can try to answer more specific questions, but telling that your DNS is not working is too ambiguous.
 
Old 09-03-2011, 10:26 AM   #3
gsm113
LQ Newbie
 
Registered: Aug 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rodrifra View Post
First I would check what in the client PC what DNS have been assigned by DHCP. If the server is correct, then obviously the problem is in the DNS server, otherwise check that you have the option domain-name-servers your.dns.ipin the correct subnect section of the /etc/dhcp/dhcpd.conf. You can also add a log-facility to get logs of your DHCP server. Do a man dhcpd.conf to learn about that configuration file.

If the problem is your DNS... well there could be a number of issues, first check if you have a logging section in your /etc/bind/dhcpd.conf and try to find the problem, I can try to answer more specific questions, but telling that your DNS is not working is too ambiguous.
After reading your answer I tried to add a log-facility called local7. But it does not appear to be writing anything to /var/log/dhcpd.log like the log facility should. The log file does not exist, will it be created automatically if there is something to log?

I know my original post was ambiguous, let me post my conf files and let me know if something catches your eye.

For reference:
my router ip is 192.168.1.1
my hostname is linux
-- something else to note: my machine's original hostname was localhost.localdomain. To log in to webmin I would enter url
Code:
https://localhost.localdomain:10000
I have since changed my hostname to linux, but must still use this old hostname to log in to webmin. Also not sure why but I must use the secure https log in, not http.

named.conf:
Code:
zone "linux." IN {
	type master;
	file "slaves/linux.zone";
        allow-update {
                 key rndckey;
        };
};
zone "1.168.192.in-addr.arpa." IN {
	type master;
	file "slaves/1.168.192.in-addr.arpa.zone";
        allow-update {
              key rndckey;
        };
};
controls {
               inet 127.0.0.1 allow { localhost; } keys { rndckey; };
       };

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;
	forwarders {
		192.168.1.1;
		};
};
include "/etc/rndc.key";

dhcpd.conf:

Code:
log-facility local7;
option domain-name-servers 127.0.0.1;
option domain-name "linux";
option broadcast-address 192.168.1.255;
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
ddns-updates on;
ddns-update-style interim;
ddns-domainname "linux";
ddns-rev-domainname "in-addr.arpa";
include "/etc/rndc.key";
ignore client-updates;
# Zones dhcpd will be updating.
zone linux {
primary 127.0.0.1;
key rndckey;
}
zone 2.0.10.in-addr.arpa {
primary 127.0.0.1;
key rndckey;
}
# linux
subnet 192.168.1.0 netmask 255.255.255.0 {
option domain-name-servers 127.0.0.1;
option domain-name "linux";
option broadcast-address 192.168.1.255;
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
ddns-updates on;
range 192.168.1.3 192.168.1.150;
}
# linux
host linux {
option domain-name-servers 127.0.0.1;
option domain-name "linux";
option broadcast-address 192.168.1.255;
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
ddns-updates on;
}
 
Old 09-03-2011, 01:45 PM   #4
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Debian
Posts: 202

Rep: Reputation: 36
Quote:
Originally Posted by gsm113 View Post
After reading your answer I tried to add a log-facility called local7. But it does not appear to be writing anything to /var/log/dhcpd.log like the log facility should. The log file does not exist, will it be created automatically if there is something to log?
Have you modified your syslog.conf too?


Quote:
Originally Posted by gsm113 View Post
-- something else to note: my machine's original hostname was localhost.localdomain. To log in to webmin I would enter url
Code:
https://localhost.localdomain:10000
I have since changed my hostname to linux, but must still use this old hostname to log in to webmin. Also not sure why but I must use the secure https log in, not http.
Have you changed your /etc/hostname to change the name of the system? Have you changed your /etc/hosts to asociate the name with the IP?

You didn't say if your problem is the DHCP or the DNS. First locate the problem, then I'll try to answer questions.
 
Old 09-03-2011, 02:06 PM   #5
gsm113
LQ Newbie
 
Registered: Aug 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rodrifra View Post
Have you modified your syslog.conf too?
Yes, I added the following line:

Code:
local7.* 						/var/log/dhcpd.log

Quote:
Originally Posted by rodrifra View Post
Have you changed your /etc/hostname to change the name of the system? Have you changed your /etc/hosts to asociate the name with the IP?
I had edited the first one, and just now edited the second. Now I can log in to webmin with the new hostname.



Quote:
Originally Posted by rodrifra View Post
You didn't say if your problem is the DHCP or the DNS. First locate the problem, then I'll try to answer questions.
I believe the problem is with DNS. When I activate both servers, then go to my windows machine in the same network, release ip, flushdns, renew ip, I can see that I have an IP from my linux server. But when I try to access a website, I get an error message that DNS lookup failed.
 
Old 09-03-2011, 02:55 PM   #6
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Debian
Posts: 202

Rep: Reputation: 36
Quote:
Originally Posted by gsm113 View Post
Yes, I added the following line:

Code:
local7.* 						/var/log/dhcpd.log
Have you reloaded configuration of syslog after changing the file, or restarted daemon?

Scanning your named.conf file I can see your forwarder is your gateway. That is wrong, a forwarder must be another DNS where yours will relay when it has no answers, I thing your gateway is not one of those. Besides, that statement is only relevant when used with forward, and I don't see a forward in any of your zones. This leads to a question, if your DNS server is asked for a name that is not in your linux domain what will it answer? It will not know what to do.

Check the next link as a reference for your configuration:

http://www.wellho.net/resources/ex.p...193/named.conf
 
Old 09-03-2011, 11:18 PM   #7
gsm113
LQ Newbie
 
Registered: Aug 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rodrifra View Post
Have you reloaded configuration of syslog after changing the file, or restarted daemon?

Scanning your named.conf file I can see your forwarder is your gateway. That is wrong, a forwarder must be another DNS where yours will relay when it has no answers, I thing your gateway is not one of those. Besides, that statement is only relevant when used with forward, and I don't see a forward in any of your zones. This leads to a question, if your DNS server is asked for a name that is not in your linux domain what will it answer? It will not know what to do.

Check the next link as a reference for your configuration:

http://www.wellho.net/resources/ex.p...193/named.conf
I have changed my forwarders to the nameservers provided by my ISP (is this right?). I am using Cox and I believe the correct nameservers are 68.105.28.12 and 68.105.29.12

These IP's were found in my old resolv.conf file. The video tutorial I was following said to change the resolv.conf file to the following:

Code:
search linux
nameserver 127.0.0.1
My other computers are still not able to reach websites when the DNS server is active with these settings. Do you see something else either in named or resolv.conf which could be the cause?
 
  


Reply



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
Setting up a local-only network with dhcp and dns jwentworth Linux - Networking 5 10-26-2010 12:04 PM
Problems setting up DHCP and DNS TheToeJoe Linux - Networking 10 12-19-2009 09:25 AM
DHCP / DNS Trouble gkurts Linux - Networking 3 06-29-2009 04:37 AM
Help in setting up Gateway, DHCP and DNS Server depam Linux - Software 1 10-06-2005 11:52 AM
Having trouble setting up DNS bsurfin Fedora 73 06-21-2004 07:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:04 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
Open Source Consulting | Domain Registration