[Dnsmasq-discuss] Assigning leases based on relay agent IP address?
Brian Rak
brak at gameservers.com
Thu Jun 12 14:44:09 UTC 2014
On 6/11/2014 4:43 PM, Simon Kelley wrote:
> 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.
Yep, that was exactly the cause of the issues. The 'auto' was confusing
it, so it was guessing a netmask for the subnets. It was guessing
255.0.0.0, so all the networks seemed to be available.
Once I removed 'auto', everything is working correctly. I'm not even
sure where I got that, I don't see it in the documentation.
>
>> 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.
>
>
> _______________________________________________
> 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