Click to See Complete Forum and Search --> : DHCP updating DNS?


Huge
09-22-2002, 03:12 PM
Hello all,

I'm into day 4 of my adventures in Linux-land and have come to a grinding halt. I have a set up mini-home network with a RH 7.3 server acting as an internet gateway, DHCP server, NAT etc.

I guess there are two things I'm confused about..

1) I'd like to be able to ping machines in my home network (home.net) by their name. Does this mean I need to setup a full DNS server or is there some easier way of doing it. If I do, is there a simple example of how to do that because I've tried, and failed.

2) This may be related to 1) above, but when I do an nslookup to my linux box from another machine running WinXP I get a hostname of 10.10.10.10 everytime and I can't figure out why. My whole internal network is in the 192.168.0.x range.

vttimwhite
09-23-2002, 06:35 AM
Originally posted by Huge
(1) I'd like to be able to ping machines in my home network (home.net) by their name. Does this mean I need to setup a full DNS server or is there some easier way of doing it. If I do, is there a simple example of how to do that because I've tried, and failed.You do not need a DNS server for name resolution. In the /etc directory you will find a file called hosts. It is a very simple file. Add each IP address/Name mapping on a separate line and your names will resolve. Do not disturb the first line.

2) This may be related to 1) above, but when I do an nslookup to my linux box from another machine running WinXP I get a hostname of 10.10.10.10 everytime and I can't figure out why. My whole internal network is in the 192.168.0.x range. Unless I am mistaken, nslookup first queries your DNS server. You can redirect it to other DNS servers (up to and including the root servers). I suspect you've got a rogue setting in your DHCP somewhere.

Huge
09-23-2002, 12:23 PM
Hi.

If I do that though the hosts file needs to be on each machine in the network, which means I might as well not use DHCP as I'd have to manually enter each IP address into each hosts file.

vttimwhite
09-23-2002, 12:46 PM
That is correct. You would have to create a hosts file for every machine on the network. You can copy it though. It all comes down to the amount of work you want to do manually.

DHCP is helpful if you have many settings to assign to the individual machine. It does far more than just assign the IP address/subnet mask and default gateway.

DNS is helpful if you have a lot of machines and need name resolution.

The Whizzard
09-23-2002, 01:07 PM
Dynamic DNS(DDNS) and DHCP (http://www.linuxsa.org.au/meetings/ddns-dhcp/), I couldn't find any documentation on this but if you look through the sample files, you should get an idea of what's going on.

The key to all of this seems to be DHCP_UPDATER, as in the following named.conf:

options {
directory "/etc/namedb";
};

key DHCP_UPDATER {
algorithm HMAC-MD5.SIG-ALG.REG.INT;
secret 2MXOy+MWw4zal3u3000XiA==;
};

zone "." {
type hint;
file "named.root";
};


zone "foo.com" {
type master;
file "foo.zone";
allow-update { key DHCP_UPDATER; };
};

zone "2.0.10.in-addr.arpa" {
type master;
file "foo.rev";
allow-update { key DHCP_UPDATER; };
};


and dhcpd.conf:

server-identifier test.foo.com;

option domain-name "foo.com";

ddns-update-style interim;
key DHCP_UPDATER {
algorithm HMAC-MD5.SIG-ALG.REG.INT;
secret 2MXOy+MWw4zal3u3000XiA==;
};


zone foo.com {
primary 10.0.2.1;
key DHCP_UPDATER;
}

zone 2.0.10.in-addr.arpa {
primary 10.0.2.1;
key DHCP_UPDATER;
}

use-host-decl-names on;


subnet 10.0.2.0 netmask 255.255.255.0 {
range 10.0.2.20 10.0.2.250;
}


I hope this helps. :)

vttimwhite
09-23-2002, 07:06 PM
If you have only a few machines, the dynamic DNS might be more trouble than it's worth. You can simply create a DHCP reservation so that each machine always gets the same IP address (based on its MAC address) and then create the hosts file. This allows you to update other settings via DHCP automatically.

Then, if a name server address or default gateway changes, one edit to dhcpd.conf and you're done.