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

Simon Kelley simon at thekelleys.org.uk
Thu Jan 18 12:02:50 GMT 2007


Carlos Carvalho wrote:
> 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?

Yes, dnsmasq will use the dhcp-host line which matches the network.
> 
> 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?

Yes; if you give more than one netid in an option, then they all have to
match for the option to be sent.

> An alternative
> would be to set more than one netid in the dhcp-host declaration but
> it's not clear if this is possible.

It isn't possible.

Cheers,

Simon.

> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 




More information about the Dnsmasq-discuss mailing list