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

Ron Frederick ronf at timeheart.net
Mon Jul 6 19:38:16 BST 2009


Hi Richard...

On 7/4/09 6:47 PM, richardvoigt at gmail.com wrote:
> dnsmasq will only consider address matches from the same subnet as the
> local IP address(es) on the interface where the request arrived.
>
> But you may have to use dnsmasq configuration (dhcp-host) instead of
> /etc/ethers, because as you say /etc/ethers doesn't provide space for
> multiple IPs.  dhcp-host can match based on MAC address instead of
> client id.
>    

Thanks for the suggestion. This is actually the first thing I tried, but 
it didn't work. I think the reason is that the later dhcp_host line 
overrides the earlier one when they both have the same MAC address 
listed. What you suggest would have worked fine (with no special 
configuration) if I was willing to accept a dynamic IP, but it won't 
work for static IPs. It worked with client IDs because I was able to 
make the names different, preventing the rules from clashing with one 
another.

After doing some more reading, I think the option I need is the 
"dhcp-fqdn" option in dnsmasq 2.46, possibly combined with the support 
there for the ability to associate domains with specific subnets. 
Unfortunately, I'm currently running an older release of dnsmasq (2.35) 
on my Linksys router, so I've been unable to try this yet. If I'm 
reading things right, though, this would let me put the unqualified name 
in /etc/ethers and have qualified names in two different domains in 
/etc/hosts and have dnsmasq assign the right IP depending on which 
domain was associated with the subnet the request arrived on. Can anyone 
confirm this for me?

Is there any way to get this kind of behavior with pre-2.46 dnsmasq? It 
looked to me at one point like "localise-queries" might have been enough 
here, but that didn't seem to be enough.

> On Sat, Jul 4, 2009 at 7:14 PM, Ron Frederick<ronf at timeheart.net>  wrote:
>    
>> Hello...
>>
>> 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 192.168.1.0/24 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:
>>
>> dhcp-host=id:foo,foo
>> dhcp-host=id:foo-private,foo-private
>>
>> 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