LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   DHCPD configuration to not give default gateway to a set of clients (https://www.linuxquestions.org/questions/linux-general-1/dhcpd-configuration-to-not-give-default-gateway-to-a-set-of-clients-4175470911/)

ugob 07-25-2013 02:40 PM

DHCPD configuration to not give default gateway to a set of clients
 
Hi,

In a specific subnet, there are some DHCP clients that I don't want to have a default gateway, but I want all the other clients to have a default gateway set.

I can identify the exception hosts by MAC address without problem, but what would I use as config in dhcpd.conf?

For the curious, I need this config because most clients in this subnet are regular clients, with only one IP address, but a few of them are Windows clients that are in 2 vlans and if I provide two default gateway to a Windows machine, it doesn't know which one to use or chooses randomly, and when it uses the wrong one, it can't reach its destination.

Here is what I tried:

Code:

subnet 192.168.13.0 netmask 255.255.255.0 {

        class "Win" {
                match hardware;
        }

        subclass "Win" 64:31:50:33:B5:23;
        subclass "Win" 40:0e:85:03:61:17; 

# Pools

        pool {
        range 192.168.13.50 192.168.13.150;
        option domain-name-servers      192.168.x.x,192.168.x.x;
        option domain-name                      "mydomain.lan";
        option routers 192.168.13.1;
        option subnet-mask 255.255.255.0;
        deny members of "Win";
        }

        pool {
        range 192.168.13.170 192.168.13.200;
        option domain-name-servers      192.168.x.x,192.168.x.x;
        option domain-name                      "mydomain.lan";
        option subnet-mask 255.255.255.0;
        allow members of "Win";
        deny unknown-clients;
        }
}

However, clients that match the configured MAC addresses still get the same IP address and still get the default gateway.

Ser Olmy 07-25-2013 06:37 PM

Have you been able to determine whether the problem is with the class/subclass definition or if the second pool incorrectly "inherits" the gateway setting from the first pool? Temporarily changing another, common pool parameter (like the domain name) should help narrow it down.

FWIW, in the sample configurations I've seen, the syntax for MAC address matching has always looked like this:
Code:

class Win {
match pick-first-value (option dhcp-client-identifier, hardware);
}

You could try that and see if it makes a difference.


All times are GMT -5. The time now is 08:27 AM.