[Dnsmasq-discuss] When Client is set to DHCP

Simon Kelley simon@thekelleys.org.uk
Tue, 30 Nov 2004 07:51:05 +0000

Kenyatta Senior wrote:
> Maybe I have it all wrong BUT  how do i set up dnsmasq if my client is
> set for DHCP??? I can't add that particular machine in /etc/hosts.
> Since I won't know what IP it will be given.
> THe client gets an IP address... BUT i can't ping alpha. :-( Is there
> is settign in /etc/dnsmasq.conf that i'm missing?

I think that what you are asking for is a way to tell dnsmasq "add an 
entry in the DNS for name <foo> and the address currently assigned to 
interface <bar>", so that you can name a machine which has it's outside 
interface address set by the ISP's DHCP system (or PPP, for that matter).

Such a facility doesn't exist: I've thought of adding it, but the 
reasoning for not doing so goes like this: there are two reasons for 
doing this, either you need a stable name for the system just within the 
local net behind dnsmasq, or you need a stable name for the system which 
resolves to its public IP _everywhere_ for doing incoming connections 
from outside.

In the first case, the solution is just to add a name to /etc/hosts for 
the IP address of the internal network interface. That never changes and 
it will work fine to access the machine from the local network.

In the second case, you need the name to resolvable everywhere so the 
dnsmasq instance on the router machine is not the correct place to do 
it. (You would need to talk to dnsmasq to get the public address of your 
machine, but you need the public address of your machine to talk to 
dnsmasq....) The solution in this case is a dynamic DNS provider like