[Dnsmasq-discuss] setting up dynamic DNS?
simon at thekelleys.org.uk
Sun Sep 9 16:02:18 BST 2007
Adam Hardy wrote:
> Hi DNSmasq List
> I have a small network with a slightly different setup for the internet
> broadband from usual. I'm having problems working out how to set up a DHCP
> service with dnsmasq to provide workstations with permanent host names.
> Instead of the usual router providing DHCP and DNS services, I just have a
> simple DSL modem attached to eth2 on my gateway server (isengard). Using
> dhclient3, isengard grabs itself a public ip for eth2 via DHCP on the modem.
> isengard also runs dnsmasq on eth1 for the internal network, and I run iptables
> as my firewall to protect it. I gave eth1 the IP 192.168.0.2
> I have 2 more linux boxes, a windows machine and a mac, and the potential for
> other random laptops to come and go. What I want to do is set it up so that I
> can refer to boxes by their hostname at least in linux wherever I am on the
> network, since I do alot of ftp'ing and ssh'ing and I want to set up a samba
> share for backups and cups for printing.
> I've reached the point where dnsmasq tells every client to use 192.168.0.2 as
> the nameserver. These clients run dhclient3 (and windows and the mac are happy too)
> But this naive approach obviously doesn't cut the mustard. Can I instruct
> dnsmasq to be nameserver of all my hosts for each other?
> Thanks and regards
> Adam Hardy
> PS this is the hosts and resolv.conf from one client:
> adam at gondor:~$ cat /etc/hosts
> 127.0.0.1 localhost gondor.localdomain.net gondor
> adam at gondor:~$ cat /etc/resolv.conf
> search localdomain.net
> nameserver 192.168.0.2
> and /etc/dhcp3/dhclient.conf:
> send dhcp-lease-time 3600;
> supersede domain-name "localdomain.net";
> request subnet-mask, broadcast-address, time-offset, routers,
> domain-name, domain-name-servers, host-name,
> netbios-name-servers, netbios-scope, interface-mtu;
> send fqdn.fqdn "gondor.localdomain.net";
> send fqdn.encoded on;
> send fqdn.server-update off;
> isengard /etc/dnsmasq.conf:
All your hosts are using dnsmasq as their nameserver, so once it knows
the hostnames associated with particular DHCP leases, everything will
Broadly, there's two ways to do this. The first is to add names to the
dnsmasq configuration, associating MAC addresses with names using
dhcp-host configuration directives or in /etc/ethers. The second, and
more common, is for the host to know its hostname, and send it to the
DHCP server when it requests a lease: Windows (and, I'm fairly certain,
Macs) do this always. dhclient3 needs to be told to do it with something
send host-name "myname"
in /etc/dhcp3/dhclient.conf. Some distros are clever and configure this
automatically: most (still) don't. Sigh.
STOP PRESS. Looking again, I see you're ahead of me, and sending the
fqdn instead of the hostname. That should be fine, but you need to tell
dnsmasq that "localdomain.net" is a valid network for it to accept for
local hosts. Adding
to /etc/dnsmasq.conf will do the trick.
More information about the Dnsmasq-discuss