[Dnsmasq-discuss] Best way to assign different static IPs on different VLANs?

Ron Frederick ronf at timeheart.net
Sun Jul 5 01:14:07 BST 2009


I have been using dnsmasq for a number of years now and it has been 
working great. I recently rearranged my network slightly, though, and 
while I have the new configuration working again, I'm wondering if 
there's a better way to do what I'm trying to do.

Basically, I have two subnets at home. One of them is a public /29 
subnet provided by my ISP. The other is a local network I 
use for internal hosts. I have dnsmasq running on a Linksys WRT54GS 
under OpenWRT. One of my hosts needs to be on both networks, so am I 
using VLANs on both the Linksys and the host for this. VLAN 1 on the 
Linksys is my public subnet and VLAN 2 is my private one. On both the 
Linksys and the dual-homed host, I use VLAN tagging to keep the private 
network traffic separate from the public traffic.

What I'd like to do is have dnsmasq automatically assign a static public 
IP when it sees a request on VLAN 1 and a static private IP when it sees 
a request on VLAN 2, even though it will see the same MAC address in 
both requests. Can this be done? Normally, I just fill in MAC address 
information in /etc/ethers and host information in /etc/hosts and the 
static mapping is automatically made. However, since I can only 
associate a single name with the MAC address in /etc/ethers, I'm not 
sure how to configure the two different IPs I'd like to assign.

For now, I have told the dual-homed host to use different client IDs 
(foo and foo-private) in its two requests, and then added entries like:


By putting entries in /etc/hosts for foo and foo-private, the right 
thing seems to happen. However, it feels like there should be a way to 
do this without using client IDs, since dnsmasq knows which VLAN the 
request is arriving on.

I've checked through the documentation and I don't see anything which 
covers this specific case. Is there a way to do what I'm looking to do?

Ron Frederick
ronf at timeheart.net

More information about the Dnsmasq-discuss mailing list