I have dhcp set up using DNSMasq, which looks like this:


What I need to be able to do is set the gateway 'dhcp-option 3' for each interface separately, which I expected would look like this:


However, this does not work. What would be the correct way of setting up independent gateways on a per-interface basis?


It stands to reason that the syntax in the question would make sense. However, it is even simpler than that:


[Edit] After a couple years of this in use, I'm reporting a problem with this setup. Say you have a public and a secure network, both accessible via WiFi. If your device connects to the public network, but you wish to switch to the secure one, your device and the DHCP server will try to re-use your address lease from the public network, resulting in an invalid address for the subnet you now occupy. This could probably be fixed by setting lease time to zero, but that may have other adverse effects depending on your network requirements (network printer addresses, etc).

  • i'm actually facing the edit you wrote about. lease time to 0 would not flood the network for dhcp lease requests ?
    – y_nk
    Oct 21 '16 at 9:51
  • Looking around the internet and talking to friends better versed in networking, that seems likely.
    – SuperJer
    Oct 24 '16 at 15:09

You can do this with range tags:

  • If you have any links to documentation on the how and why of range tags, it's a good way to expand the answer for future reference. Mar 1 '17 at 0:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.