4

In Linux how can I set a DHCP server configuration which will lease IP addresses from scopes which are defined according to user classes. For example the following configuration leases IP addresses according to the first three octets of mac addresses:

# MODIFY TO MATCH YOUR ENVIRONMENT
class "phones"    { match if substring (hardware,1,3) = 00:11:22; }
class "handhelds" { match if substring (hardware,1,3) = 00:33:44; }

# Common configuration
option domain-name "your.domain.name.here";
option domain-name-servers 192.168.2.2;

shared-network lan {
        # phones
        subnet 192.168.0.0 netmask 255.255.255.0 {
                pool {
                        range 192.168.0.10 192.168.0.254;
                        allow members of "phones";
                }
                option routers 192.168.0.1;
                option subnet-mask 255.255.255.0;
        }

        # handheld devices
        subnet 192.168.1.0 netmask 255.255.255.0 {
                pool {
                        range 192.168.1.10 192.168.1.254;
                        allow members of "handhelds";
                }
                option routers 192.168.1.1;
                option subnet-mask 255.255.255.0;
        }

        # Everything else
        subnet 192.168.2.0 netmask 255.255.255.0 {
                pool {
                        range 192.168.2.10 192.168.2.254;
                        allow unknown-clients;
                }
                option routers 192.168.1.1;
                option subnet-mask 255.255.255.0;
}

I want a functionality similar to this but not for the first three octets of MAC addresses but for the user option class (77) of the DHCP request.

1 Answer 1

1

You can use a block like:

class "phones" { 
  match if exists user-class and option user-class = "foobar";
 }

Useful references:

2
  • Hello I have just had the chance to test dhcp. Analyzing the traffic I saw that the clients do not send option 77. It seems that I need to force the clients to send option 77 user-class. Only after than I can lease IP addresses. How can I force clients to send option 77?
    – Alptugay
    May 27, 2013 at 9:27
  • 1
    Please edit your question accordingly or ask a new one.
    – dawud
    May 27, 2013 at 9:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .