[Dnsmasq-discuss] Specifying a Gateway

Simon Kelley simon@thekelleys.org.uk
Mon, 08 Nov 2004 07:22:32 +0000


Steve Elzinga wrote:
> Hello,
> 
> I am afraid that this is a totally rookie question but
> I could not find the information.  How do I specify a
> gateway address when running dnsmasq on a computer
> that is not the gateway?  I have a linksys "router"
> connected to my cable modem.  The Linux computer
> running dnsmasq is connected to the router.  The are
> other computers / network appliances connected to the
> router as well.  Is there a way through dnsmasq to
> transmit the gateway address?  My computers (and
> network appliances) end up using the Linux computer as
> the gateway since they receive their IP address from
> the Linux computer.  Any help is greatly appreciated.
> 

Short answer:

dhcp-option=3,1.2.3.4

Long answer:

You can either add --dhcp-option=3,<gateway address> to the command line 
  used to run dnsmasq, or put the line

dhcp-option=3,<gateway address>

into /etc/dnsmasq.conf

The magic number 3 here is the DHCP standard option number for "router" 
which is specified in RFC 2132. Typing "RFC2132" into Google will find 
myriad copies of this.

It's also worth looking in the example configuration file supplied with 
the dnsmasq source, which has annotated examples of most of the common 
things people want to do, including this one.

Thanks for the question: I hope that answers it OK, (and adds the answer 
to the mailing list archive for the use of others.)

Cheers,

Simon.