[Dnsmasq-discuss] setting up dynamic DNS?

Adam Hardy adam.ant at cyberspaceroad.com
Mon Sep 10 12:14:29 BST 2007

Simon Kelley on 09/09/07 16:02, wrote:
> 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
>> 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 
>> 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
>>       localhost gondor.localdomain.net gondor
>> adam at gondor:~$ cat /etc/resolv.conf
>> search localdomain.net
>> nameserver
>> 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:
>> domain-needed
>> bogus-priv
>> filterwin2k
>> dhcp-range=,,12h
> All your hosts are using dnsmasq as their nameserver, so once it knows 
> the hostnames associated with particular DHCP leases, everything will 
> just work.
> 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 
> like
> 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
> domain=localdomain.net
> to /etc/dnsmasq.conf will do the trick.

Thanks for the responses, I've just tried again, but didn't succeed. I get 'name 
or service unknown' response from ssh, ping etc.

I put in the "send host-name" option, as well as explicitly defining the 
defaults for dhcp-option 1, 3 and 6.

Presumably if dnsmasq is meant to resolve/name-serve my clients, it will put 
their hostnames in isengard's /etc/resolv.conf?

I am probably totally wide of the mark here, but isn't dhclient3 constantly 
rewriting /etc/resolv.conf on isengard (gateway / dnsmasq server) to set up eth2 
on the internet?

I am using the example dnsmasq.conf that came with the package, but I just 
parsed out the comments. And unlike Jan, I'm not using pppoe so I'm not sure 
what approach to take.

Thanks and regards

More information about the Dnsmasq-discuss mailing list