[Dnsmasq-discuss] Patch to allow router other than local machine

Simon Kelley simon at thekelleys.org.uk
Mon Dec 19 10:30:59 GMT 2005

Jared Stafford wrote:
> I've got an ADSL router from 2wire that does not do proper DNS
> masqerading, so I installed Dnsmasq. However, I still wanted to use the
> router as the gateway. Dnsmasq did not have an option to do this, so I
> created one. Right now, it just uses a global option to set the real
> router address, any suggestions on how to improve it?

It's possible to do this without patching. The code you found calculates 
a default value for the router address. The only place that value is 
used is as DHCP option 3, in DHCP replies.

If you add the following to dnsmasq.conf

dhcp-option=3,<router address>

then dnsmasq will send the given address, instead of the default it 
calculated, as option 3. (See rfc2132 for the option numbers in DHCP 

This method also enables different router addresses for different 
subnets or even different hosts, by using network-tags.

It's worth studying the example configuration file supplied with 
dnsmasq, that covers a lot of these situations.



More information about the Dnsmasq-discuss mailing list