Tuesday, May 28, 2013

Dnsmasq and DHCP Option 60 Vendor Class Identifier

To make Dnsmasq assigned different range of IP addresses to different set of clients based on DHCP option 60 (Vendor Class Identifier), you will need to add/modify a few lines to the configuration file

1. The first thing you need to do is to add a line that will define the vendor class identifier that will be assigned to a specific name.

dhcp-vendorclass=[name],"[vendor class identifier]"

The vendor class identifier can be entered in full or partial. The example shown below will assigned any clients with vendor class that contains MSFT to vendor class name WINDOWS

dhcp-vendorclass=windows,"MSFT"

2. The next thing to do is the add the following line that will assign a range of IP addressed based on the vendor class identifier

dhcp-range=net:[name],net:[interface],[start of range],[end of range],[lease period in hours]h

This example below will assign clients with vendor class identifier as defined in vendor class name WINDOWS on interface ETH0 with IP addresses starting from 192.168.0.1 - 192.168.0.127 for a lease period of 24 hours

dhcp-range=net:windows,net:eth0,192.168.0.1,192.168.0.127,24h

To do a reverse, that is to assign a range of IP addresses to clients that do not contain the vendor class identifier in vendor class name WINDOWS, you use the '#' sign, which is the same as 'NOT EQUALS TO', as shown below

dhcp-range=net:#windows,net:eth0,192.168.0.128,192.168.0.254,24h

You can repeat the same lines for other clients with other vendor class identifiers. However, you will need to have a fall back range for those clients that do not fit to any of your specified range.

1 comment:

Joker said...

Hi, Was looking for this info since hours. lucky to land up on ur blog.
Thanx,