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

Clifford Heath clifford.heath at gmail.com
Thu Jul 3 07:50:14 UTC 2025


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


More information about the Dnsmasq-discuss mailing list