Configuring DHCP server options selectively based on vendor class?

The networkid should correspond to the name of the config dhcp section, usually lan.

Edit: that would apply the option 66 to all LAN clients which isn't what we want. The networkid should indeed be another tag value to tie the vendor class to the option.

I just tried this:

config vendorclass
        option networkid 'gxp2124'
        option vendorclass 'Grandstream GXP2124'                   
        list   dhcp_option '66,http://10.10.100.31/phones/cfg-auto'

Which was translated to these options in /var/etc/dnsmasq.conf.*:

dhcp-vendorclass=gxp2124,Grandstream GXP2124
dhcp-option=gxp2124,66,http://10.10.100.31/phones/cfg-auto

Meaning "when vendor class contains the substring Grandstream GXP2124, apply the tag gxp2124 to it. For tag gxp2124 add option 66 with value http://10.10.100.31/phones/cfg-auto."

I then tested it from my workstation by adding send vendor-class-identifier = "Grandstream GXP2124"; to /etc/dhcp/dhclient.conf. After killall -9 dhclient; dhclient wlan0 I could verify that the value of option 66 was put into the sname field of the DHCP reply:

3 Likes