[Dnsmasq-discuss] multiple subnets behind DHCP relay

Carlos Carvalho carlos at fisica.ufpr.br
Mon Mar 21 20:37:03 GMT 2011


Simon Kelley (simon at thekelleys.org.uk) wrote on 21 March 2011 13:50:
 >Takács Balázs wrote:
 >> Dear all,
 >> 
 >> 
 >> The relay sends all the request from 10.1.0.1 IP address. The default
 >> subnet for clients is the 10.1.0.0. This works ok. Based on client
 >> mac address I would like to place some clients in 195.x.x.0/24
 >> (public ip)subnet. I have set both the pools for 10.1.0.0 and
 >> 195.x.x.0 subnets in dnsmasq.conf and placed mac address ip address
 >> pairs to /etc/ethers file for clients have to get public address. But
 >> the specified clients still get ip from 10.1.0.0 pool. Is there a
 >> possibility to force dnsmasq to ignore the DHCP relay address and try
 >> to give out address even in case of subnet missmatch?
 >> 
 >
 >There's no easy answer to this. If you were not using a DHCP relay, it
 >would work fine: dnsmasq is clever enough to work out all the addresses
 >that correspond to a physical network. Sadly, the relay only includes a
 >single address. It's possible for the relay to include a different
 >address for subnet selection, using the subnet selector option, but that
 >still only gives you one address and you need two.
 >
 >I've thought about adding an equivalent to the ISC "shared-network"
 >declaration, which is not pretty, but would work.

I think this already works, since you can have more than one
dhcp-range in one subnet.

Takács Balázs (takyka at freemail.hu) wrote on 19 March 2011 14:04:
 >I have a setup where there are two (or more) separate subnets behind a DHCP relay. 
 >
 >                 DHCP relay
 >               |------------|           |-------------|
 >    10.1.0.1/16|eth1        |10.0.0.0/16|Dnsmasq sever|
 > --------------|        eth2|-----------|             |
 >   195.x.x.1/24|eth1.1      |           |             |
 >               |------------|           |-------------|
 >
 >
 >  The relay sends all the request from 10.1.0.1 IP address. The default subnet for clients is the 10.1.0.0. This works ok.
 >  Based on client mac address I would like to place some clients in 195.x.x.0/24 (public ip)subnet.

It may depend on how you want to decide based on the mac. Here's an
example to give public IPs to registered machines and local to the
rest:

dhcp-range=tag:known,195.x.x.2,195.x.x.254,255.255.255.0
dhcp-range=tag:!known,10.1.0.2,10.1.255.254,255.255.0.0

You can also separate the known ones among the 195.x.x by defining
tags in the dhcp-host declaration and matching them in the dhcp-range.



More information about the Dnsmasq-discuss mailing list