[Dnsmasq-discuss] Different DHCP options offered to different static IP assignments on the same network?

Clifford Heath clifford.heath at gmail.com
Fri Jul 4 08:00:33 UTC 2025


Simon,

Thanks for your positive answer. I want to say up front how much your work is appreciated!

I am using static IP addresses because I don’t run my own DNS server. I just distribute an /etc/hosts everywhere, which would be a pain if it changed often.

I assume I could instead use dnsmasq to serve DNS results for the hosts to which it assigns DHCP addresses from a dynamic pool...

Which would require me to associate each MAC address with a hostname to use for DNS, so that still needs to be statically managed, but not distributed everywhere liker /etc/hosts does.

I suspect that is a common scenario, and should have a case study/example somewhere…

I have had difficulty finding appropriate examples because the ones provided are mostly small cases, which a reader can only relate to their environment when they already have a knowledge of how the pieces are meant to fit together. I would like to find (or help write!) some “big picture” examples of complete configurations that serve common setups.

Clifford Heath.

> On 4 Jul 2025, at 12:46 am, Simon Kelley <simon at thekelleys.org.uk> wrote:
> 
> There are a million ways to so this: you can jump down the whole policy-routing rabbit-hole if you wish: That pretty much needs control of the router, so the OpenWRT path.
> 
> If you just have control of the DHCP server, your suggestion is the best way to go. I assume you can turn off the DHCP server in your ISP-supplied router. If not the two will fight each other.
> 
> It's not clear if you want to have different subnets or address ranges or if you landed on those as a mechanism to  just differentiate hosts.
> 
> The simplest config would be to have everything on the same subnet
> (say 10.10.1.1/24), not bother with address ranges or static assignments and just control the default route.
> 
> That comes out as
> 
> dhcp-range=10.10.1.33.10.1.254
> 
> # send this router unless tag vpnroute set
> dhcp-option=option:router,10.10.1.1
> # send this router when tag vpnroute set
> dhcp-option=tag:vpnroute,option:router,10.10.1.6
> 
> # Mark host with tag vpnroute
> > dhcp-host=11:22:33:44:55:66,set:vpnroute
> > dhcp-host=77:88:99:AA;BB:CC,set:vpnroute
> > # etc...
> 
> Simon.
> 
> 
> 
> On 7/3/25 08:50, Clifford Heath wrote:
>> I want to run static IP address assignments for most of my hardware in the house here, but I have specific devices which I want to receive a different router (default gateway) setting. The use case is that I have some embedded devices which must route to my VPN host by default, so they don't appear on my home IP address. I don't want to run everything through the VPN, because latency from Australia creates a poor experience.
>> Obviously I can't do it on my unmodified WiFi router, so I will either be flashing OpenWRT (which runs dnsmasq) or just running dnsmasq on a Raspberry or something. The OpenWRT method might be incompatible with my internet modem however, apparently that requires some technical support which my ISP configured in the router… but anyway, back to dnsmasq...
>> I have been studying the dnsmasq manual page, and you can assign different DHCP options to apply to requests coming from different interfaces, but I'm not expecting to have more than one interface.
>> So my questions are two:
>> 1) Can dnsmasq accept different router options for individual static DHCP assignments?
>> Even better if I can say “all static IP assignments in this IP range should use these options”
>> 2) Alternatively, is there some use of virtual subnets which would make this possible?
>> In short, can I combine the "--dhcp-option=option:router,192.168.4.4" option with static IP assignment?
>> Reading more, I expect I’ll need to do something like this. Please point out any glaring errors. And how to integrate DNS hostnames into this plan... :)
>> # DHCP ranges:
>> #dhcp-range=10.10.1.1,10.10.1.32  # Static wired Ethernet addresses that should NOT be served by DHCP
>> dhcp-range=10.10.1.33.10.1.254 # Wired Ethernet addresses that should be served by DHCP, including some static IPs
>> dhcp-range=10.10.2.1,10.10.2.254 # Wireless addresses that should be served by DHCP, including some static IPs
>> dhcp-range=set:vpnroute,10.10.3.1,10.10.3.254 # Wireless addresses that should use the VPN (all are static IPs)
>> # Mark host with tag vpnroute
>> dhcp-host=11:22:33:44:55:66,set:vpnroute,10.10.1.45
>> dhcp-host=77:88:99:AA;BB:CC,set:vpnroute,10.10.1.46
>> # etc...
>> # Set default route
>> dhcp-option=option:router,10.10.1.1
>> # Set route for vpnroute to point at the VPN router
>> dhcp-option=tag:vpnroute,option:router,10.10.1.6
>> Clifford Heath, Sydney
>> _______________________________________________
>> Dnsmasq-discuss mailing list
>> Dnsmasq-discuss at lists.thekelleys.org.uk
>> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss




More information about the Dnsmasq-discuss mailing list