0

I'm attempting to create a different subnet for a few specific mac addresses, and have my DHCP config set up as follows:

authoritative;

shared-network local {

 subnet 192.168.2.0 netmask 255.255.255.0 {
  range 192.168.2.1 192.168.2.99;
  option broadcast-address 192.168.2.255;
  option routers 192.168.1.100;
  option domain-name "local-network-spec";
  option domain-name-servers 8.8.8.8, 8.8.4.4;
  deny unknown-clients;
  host mdev {
   hardware ethernet 40:40:40:40:40:40;
  }
 }

 subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.1 192.168.1.99;
  option broadcast-address 192.168.1.255;
  option routers 192.168.1.1;
  option domain-name "local-network";
  option domain-name-servers 8.8.8.8, 8.8.4.4;
 }
}

However, I appear to have mis-configured something, because the relevant lease appears as follows:

lease 192.168.1.5 {
  starts 3 2014/04/16 19:10:41;
  ends 4 2014/04/17 07:10:41;
  cltt 3 2014/04/16 19:10:41;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 40:40:40:40:40:40;
  client-hostname "MyMachine";
}

The key here is the routers option is set differently for the different subnet. However, interestingly despite not being an IP address in the desired subnet, the client is provided with the correct gateway - 192.168.1.100 as oppose to 192.168.1.1 - so something is clearly being used from the first subnet declaration.

Any ideas what I'm doing wrong here?

1 Answer 1

1

I don't know if this will fix the problem completely, but for starters your router needs to be located on the same subnet. 192.168.1.100 is not within 192.168.2.0/255.255.255.0. If the lease were to be granted as you've configured it, the client would have no path to reach 192.168.1.100 which is on a different subnet.

4
  • Hmm, good point - though I did also put them both on 192.168.1.0/24 (ranges 192.168.1.1-192.168.1.50 and 192.168.1.51-192.168.1.100) but again no dice. I could understand why one failed and it fell back to the other, but it seems to be oddly mixing the two.
    – berry120
    Apr 16, 2014 at 22:07
  • Are you simply trying to give this box an IP that's not in the normal dynamically allocated range? Or do you actually need two separate subnets? If it's the former, just add a host stanza using an IP that is not listed in 'range' but is within your subnet. If you need two separate subnets, then you need two separate router addresses. One for each subnet that lives on that subnet. Your subnet declarations shouldn't be overlapping.
    – user143703
    Apr 16, 2014 at 22:12
  • (left out gateway) I would assume just putting a different gateway within the host stanza would work on a single subnet declaration.
    – user143703
    Apr 16, 2014 at 22:17
  • I'd like two separate subnets in this case - there's a few dozen hosts sitting on it in reality, I just narrowed it down for the scope of the question. I wasn't aware (somewhat naively!) that the router had to be located on the same subnet, though that seems a bit obvious now! thanks for the help.
    – berry120
    Apr 16, 2014 at 22:21

You must log in to answer this question.

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