LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   DHCP / DNS issue (http://www.linuxquestions.org/questions/linux-server-73/dhcp-dns-issue-4175442222/)

tombelcher7 12-19-2012 05:34 PM

DHCP / DNS issue
 
Hello LQ Community,

I have installed Ubuntu 12.10 server to replace a Windows Server 2008 R2 Box and have set up isc-dhcp-server, bind9, samba and webmin and have setup a dhcp subnet as follows:

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1;
option domain-name "HOMEDOMAIN";
}

but yet when I do ipconfig /all from a win7 host on this network it gives me an IP from the pool but it comes up saying preferred and the dns server is set to 8.8.8.8 (Google DNS).

It's supposed to be getting 192.168.1.1 for the DNS but it isn't?

ufw status:

To Action From
-- ------ ----
135/tcp ALLOW 192.168.1.0/24
139/tcp ALLOW 192.168.1.0/24
445/tcp ALLOW 192.168.1.0/24
137/udp ALLOW 192.168.1.0/24
138/udp ALLOW 192.168.1.0/24
22 ALLOW 192.168.1.0/24
67/udp ALLOW 192.168.1.0/24
53/udp ALLOW 192.168.1.0/24
443/tcp ALLOW 192.168.1.0/24
10000/tcp ALLOW 192.168.1.0/24
389 ALLOW 192.168.1.0/24


Can anyone help me understand how to fix the DNS setting and resolve the (preferred) thing with the IP addresses..........

rylan76 12-20-2012 01:04 AM

Not sure what you did wrong... you do not show your complete dhcpd.conf - here is my dhcpd.conf and I get exactly the behaviour you seem to want in my setup.

I'm running Centos 6 on my Linux box and a mixed network of Win7 and XP machines. Also, I'm on a class B network so my IP addresses will differ from yours, but the logic should remain the same:

Code:

authoritative;
ddns-update-style interim;
allow client-updates;
allow unknown-clients;
ddns-updates on;
ddns-domainname "domain.com";
ddns-rev-domainname "in-addr.arpa.";
include "/etc/rndc.key";

subnet 172.16.0.0 netmask 255.255.0.0 {

option routers                          172.16.1.6;
option domain-name-servers              172.16.1.1;
option netbios-name-servers            172.16.1.1;
option subnet-mask                      255.255.0.0;
option broadcast-address                172.16.255.255;
option domain-name                      "domain.com";
option domain-search                    "domain.com";

update-optimization on;
ping-timeout 5;

range dynamic-bootp 172.16.1.51 172.16.255.254;
default-lease-time 43200;
max-lease-time 86400;

host ns {
        next-server ns1.domain.com;
        hardware ethernet E1:70:94:D2:0F:DB;
        fixed-address 172.16.1.1;
        ddns-hostname "domain.com";
        }
}

zone domain.com. {
        primary 127.0.0.1;
        key rndc-key;
}

zone 16.172.in-addr-arpa. {
        primary 127.0.0.1;
        key rndc-key;
}

I then made sure that

- 172.16.1.1 runs BIND9 to resolve names
- 172.16.1.1 runs Samba's NMBD to provide WINS / NetBIOS name services as implied by the dhcpd.conf above.

If I then do

Code:

ipconfig /release
ipconfig /renew
ipconfig /all

on my XP and Win7 machines to force them to re-obtain a DHCP lease which are on this class B network with the Centos box at 172.16.1.1 doing DHCP, all my XP and Win7 machines show for ipconfig /all that they have gotten the 172.16.1.1 address as the DNS server address to use, and they then attempt to do so...

Does this help?

tombelcher7 12-20-2012 05:15 PM

I'll give it a go and will let you know how it goes but it won't be until tomorrow I would suspect............

Thanks,



Tom

Ser Olmy 12-20-2012 05:34 PM

Quote:

Originally Posted by tombelcher7 (Post 4853258)
but yet when I do ipconfig /all from a win7 host on this network it gives me an IP from the pool but it comes up saying preferred and the dns server is set to 8.8.8.8 (Google DNS).

It's supposed to be getting 192.168.1.1 for the DNS but it isn't?

It has to be getting that value from another DHCP server, or the DNS value has been configured manually.

Check the Windows network settings; it allows for dynamic address configuration while having a static DNS server value. You should also check that the DHCP server reported by ipconfig /all is your Ubuntu server.

Quote:

Originally Posted by tombelcher7 (Post 4853258)
ufw status:

To Action From
-- ------ ----
135/tcp ALLOW 192.168.1.0/24
139/tcp ALLOW 192.168.1.0/24
445/tcp ALLOW 192.168.1.0/24
137/udp ALLOW 192.168.1.0/24
138/udp ALLOW 192.168.1.0/24
22 ALLOW 192.168.1.0/24
67/udp ALLOW 192.168.1.0/24

I guess "ufw" is the Ubuntu firewall? The last line looks wrong, as DHCP requests have a source address of "0.0.0.0".

rylan76 12-21-2012 01:13 AM

Yup good point - also, see if you can (just as a test, if you are very concerned about security) completely turn off your firewall.

Then do a

Code:

ipconfig /release 
ipconfig /renew

and see what is listed as described above for the DNS server the Windows machine picks up.

If it works, your firewall is the culprit and is maybe blocking DHCP packets? You may then need to re-enable your firewall and then configure it to allow the relevant ports.

tombelcher7 12-21-2012 01:03 PM

I cannot believe it; what a rookie mistake to make the DNS was statically set! I will do the release renew and will see what it states...........

Quote:

Originally Posted by Ser Olmy (Post 4853974)
It has to be getting that value from another DHCP server, or the DNS value has been configured manually.

Check the Windows network settings; it allows for dynamic address configuration while having a static DNS server value. You should also check that the DHCP server reported by ipconfig /all is your Ubuntu server.


I guess "ufw" is the Ubuntu firewall? The last line looks wrong, as DHCP requests have a source address of "0.0.0.0".


tombelcher7 12-21-2012 02:32 PM

The DNS bit is fixed now but it still mentions that the IP Address is preferred (which surely must mean that there is still a configuration problem somewhere)???

tombelcher7 12-21-2012 02:49 PM

I've removed the bloat from the dhcpd.conf:

Code:


ddns-update-style interim;

default-lease-time 600;
max-lease-time 7200;

authoritative;

log-facility local7;

# My Subnet

subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.10 192.168.1.100;
        option routers 192.168.1.254;
        option domain-name-servers BRAINS.MYDOMAIN.LOCAL;
        option domain-name "MYDOMAIN";
        option netbios-name-servers 192.168.1.1;
        option subnet-mask 255.255.255.0;
}


Ser Olmy 12-21-2012 03:42 PM

Quote:

Originally Posted by tombelcher7 (Post 4854582)
The DNS bit is fixed now but it still mentions that the IP Address is preferred (which surely must mean that there is still a configuration problem somewhere)???

Why would "preferred" indicate a problem?

tombelcher7 12-21-2012 03:51 PM

Because every commercial / university networks I have been connected to have given me IP addresses that haven't featured the word preferred. What I have read so far is that autoconfiguration is there to allocate IP addresses for when the DHCP server cannot be contacted.

I don't think that it's failing to contact the server but something must be up??

Quote:

Originally Posted by Ser Olmy (Post 4854619)
Why would "preferred" indicate a problem?


tombelcher7 12-21-2012 04:03 PM

I've just discovered I was using ipconfig /all when I run ipconfig without the switch it doesn't show preferred. This is now fixed so I can mark as solved but before I do I'd like to know why there is a difference for the IP address between using ipconfig and ipconfig /all.


All times are GMT -5. The time now is 01:46 PM.