1

I am using ISC DHCP Server and I want to assign a different default gateway for one of the devices using that DHCP.

I have the network 192.168.0.0/24, and two redundant ISC DHCP servers assign IP addresses for hosts on this network. DHCP also publishes some routes. Some devices take into account these additional routes while some don't. For one of the devices this additional route is more important for me than the default gateway. So I would like for this device to assign a different default gateway.

Is that possible? I tried to put option routers 192.168.0.3; in host section for that host, but that seems not to be working, and to be honest I did not expect it to work.

I was thinking of using two subnets in dhcp configuration. One for regular hosts with the default gateway of this network. Another subnet would assign another gateway for hosts, for which another gateway is more important. How can I define two subnets for instance:

  1. 192.168.0.0 - 192.168.0.239 - for regular hosts with the default gateway
  2. 192.168.0.240 - 192.168.0.255 - for hosts which would use another gateway

I do not know how can I distinguish to which subnet a host would be assigned when it connects to the network. I can have only predefined MAC addresses and with reserved IPs on the second subnet. The first subnet would be for all other hosts.

For clarity I am putting here some ISC DHCP configuration:

default-lease-time 600;
max-lease-time 7200;

option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
option domain-name "localdomain";
option domain-name-servers 192.168.0.3, 192.168.0.5;

option rfc3442-classless-static-routes code 121 = array of integer 8;
option ms-classless-static-routes code 249 = array of integer 8;

option rfc3442-classless-static-routes 24, 192, 168, 1, 192, 168, 0, 3, 8, 10, 192, 168, 0, 3, 0, 192, 168, 0, 1;
option ms-classless-static-routes 24, 192, 168, 1, 192, 168, 0, 3, 8, 10, 192, 168, 0, 3, 0, 192, 168, 0, 1;

subnet 192.168.0.0 netmask 255.255.255.0 {
    pool {
        failover peer "failover-partner";
        range 192.168.0.150 192.168.0.229;
    }
    default-lease-time 86400;
    max-lease-time 172800;
}

host hostX {
    default-lease-time 86400;
    max-lease-time 172800;
    #option routers 192.168.0.3;

    hardware ethernet aa:bb:cc:dd:ee:ff;
    fixed-address 192.168.0.6;
}

The configuration assigns IPs from 192.168.0.150 to 192.168.0.229. It also assign the default gateway 192.168.0.1, and routes that route the traffic for 192.168.1.0/24, and 10.0.0.0/8 through 192.1698.0.3.

For one device (hostX) that does not need internet acces it is more important to be routed via 192.168.0.3 to another subnetwork 192.168.1.0/24.

0

0

You must log in to answer this question.

Browse other questions tagged .