[Dnsmasq-discuss] how to specify different IP's to the same machine depending on the subnet?

Carlos Carvalho carlos at fisica.ufpr.br
Thu Jan 18 04:10:01 GMT 2007


Hi,

We have different subnets, and a machine must get an address in the
corresponding range when it connects from different places. The server
has a different ethernet interface in each region like this:

eth0 is 192.168.1.9/255.255.255.0
eth1 is 192.168.2.13/255.255.255.0
eth2 is 192.168.3.34/255.255.255.0

Machine 11:22:33:44:55:66 must get ip 192.168.1.4 when the request
arrives in eth0, ip 192.168.2.123 when coming from eth1, etc. Is this
possible? I thought about this config:

dhcp-range=192.168.1.1,static
dhcp-range=192.168.2.1,static
dhcp-range=192.168.3.1,static

dhcp-host=11:22:33:44:55:66,192.168.1.4
dhcp-host=11:22:33:44:55:66,192.168.2.123

dnsmasq knows the interface the request comes in and the server
addresses and masks so it could in principle do the matching and send
the right ip. This is somewhat similar to dns localise-queries. Will
it work?

Supposing this is possible, can I set a netid in the dhcp-range
statement, another one in the dhcp-host and use both to send different
options to the same machine according to where it is? An alternative
would be to set more than one netid in the dhcp-host declaration but
it's not clear if this is possible.



More information about the Dnsmasq-discuss mailing list