Regular TLA reader Dan Dill has contributed a great article on DHCP user classes. With ever expanding networks, these little used advanced features in Windows will become more critical to all Admins. Thanks Dan for the great arcticle!
DHCP User Classes allow you to apply additional DHCP options, or a modified set of options, to certain clients on your network as identified by a user class id. For example, you may want to define a different gateway, DNS servers, or lease time for a subset of the computers on your network. This can be accomplished by setting a user class id on those clients (2000 and above) and then configuring that class id appropriately on the local DHCP server.
Note: DHCP vendor classes are somewhat similar in function however are set by the hardware or software vendors and are generally not-settable on clients. Windows clients all have a non-configurable Microsoft DHCP vendor class set that is used in DHCP configuration.
So overall for the settings to be applied the user class id has to be set on the client AND the server, otherwise the default user class will be applied. Two important things to note are: 1) that the user class id is case sensitive, so it's important to ensure the settings on the server and clients match exactly and 2) that each client can have only one dhcp user class id.
The default user class id on the DHCP server is used for DHCP requests that do not contain a user id (default/unset Windows client behavior), as well as requests from clients that do not have an id corresponding to one configured on the server. Server Configuration So to configure our server we need to open the DHCP management console, right click the DHCP server and select define user classes.
Click on the add button to add a user class then type in a name, description, and your id string in the boxes. Be sure to click under the ASCII heading to enter your user id.
Click ok to save your class id, then click close on the DHCP user classes box.
Now that we've created a user class id (in this case test) it can be configured in the DHCP options. Class id-specific options can be set in scope options or on reservations.
To set a class id option for a DHCP scope right click on scope options and select configure options.
In the scope options box click the advanced tab and then change your user class like so.
Once the desired user class is selected you can then configure specific DHCP options for that user class. Here I'm adding a DNS server option entry for 4.1.1.1 (which is not a valid DNS server IP by the way). Another useful setting can be made by selecting the default RRAS user class and then selecting option 51 to control DHCP lease times to your RRAS DHCP clients.
Back to our test user class though, once you click ok you should see your newly set options listed on the right. Note the column on the very right that shows the class id associated with each option. Options from the default class id show as "none" in that column.
Note that when using a DHCP user class id, any options specified with that id are in addition to, or in replacement of the options specified in the default class id. For example, if the record exists with a default class and a class id of test (a la the DNS servers option above), than any clients that have the class id of test will receive only the DNS server of 4.1.1.1 and NOT 4.2.2.2. Any client that does not have test set as the user class id will receive only 4.2.2.2 as the DNS server. All clients in this example, regardless of class id will receive options 003 and 015. Option 044, being only set on the test class will only be applied to clients with the class id of test.
Client Configuration
To configure your clients you use the command:
ipconfig /setclassid adapter_name class_id
where adapter name is the name of the network adapter to apply the id to. Be sure to enclose your adapter name in quotes if it contains spaces. You can also use the wildcard * for adapter_name:
The command will output its success or failure:
Assuming your syntax is correct the command will succeed or fail depending on if the adapter is currently connected or not. A key observation here is that with the wildcard used it assigned the class id to both my adapters even though it showed the output above. Once connected the LAN adapter showed the correct class id that was set by the command.
To unset your class id you can simply run the command without specifying a class id:
For more details see the following references:
Microsoft DHCP Vendor and User Classes
Microsoft Windows DHCP Team Blog
RFCs: 1497, 1541, 2131, 2132, 3004, 3925