[Dnsmasq-discuss] Assigning leases based on relay agent IP address?

Simon Kelley simon at thekelleys.org.uk
Wed Jun 11 20:43:03 UTC 2014


On 02/06/14 22:31, Brian Rak wrote:
> How can I use dhcp-match with the 'Relay agent IP address' part of the
> packet?
> 
> 
> I'm trying to manage DHCP for a bunch of different networks with one
> DHCP server.  I'd like to determine which network to use based on which
> subnet the relay server's IP address is in.
> 
> I've got a bunch of lines like this:
> 
> dhcp-range=set:SUBNETID124862,10.237.2.65,10.237.2.126,auto,255.255.255.192,2h
                                                         ^^^^^

This may be confusing the parser and leading to problems.

> 
> dhcp-range=set:SUBNETID124844,10.237.4.1,10.237.4.62,auto,255.255.255.192,2h
> 
> 
> However, when a DHCPDISCOVER comes in, dnsmasq just picks a random
> network to use.   As an example:
> 
> dnsmasq-dhcp[31908]: 2740340080 vendor class: udhcp 1.12.0
> dnsmasq-dhcp[31908]: 2740340080 DHCPDISCOVER(eth1) 00:25:90:d7:c6:7c
> dnsmasq-dhcp[31908]: 2740340080 tags: SUBNETID124844, eth1
> dnsmasq-dhcp[31908]: 2740340080 DHCPOFFER(eth1) 10.237.4.39
> 00:25:90:d7:c6:7c
> 
> The initial DHCPDISCOVER came in via 10.237.2.65, but a completely
> different subnet was used instead. (Also, is it possible to log the
> relay IP address?)
> 
> tshark shows this:
> 
> Bootstrap Protocol
>     Message type: Boot Request (1)
> ...
>     Bootp flags: 0x0000 (Unicast)
>         0... .... .... .... = Broadcast flag: Unicast
>         .000 0000 0000 0000 = Reserved flags: 0x0000
>     Client IP address: 0.0.0.0 (0.0.0.0)
>     Your (client) IP address: 0.0.0.0 (0.0.0.0)
>     Next server IP address: 0.0.0.0 (0.0.0.0)
>     Relay agent IP address: 10.237.2.65 (10.237.2.65)
>     Client MAC address: 00:25:90:d7:c6:7c (00:25:90:d7:c6:7c)
> 
> 
> This is with dnsmasq 2.71

What you're asking for should be standard mode of operation. Check the
dhcp-range lines, as shown above. I assume you have log-dhcp in your
config? If so it should log the available subnets for each DHCP transaction.

Cheers,

Simon.




More information about the Dnsmasq-discuss mailing list