Brian Rak
2014-06-02 21:31:58 UTC
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
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
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
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