0

I have a Ethernet printer which should be running behind a Raspi which is connected via WiFi to the rest of the network. Network wise this is working fine, but I have issues with the ISC DHCP server using the following /etc/dhcp/dhcpd.conf:

subnet 10.0.50.0 netmask 255.255.255.224 {
    range 10.0.50.10 10.0.50.15;
}
host printer {
  hardware ethernet aa:bb:cc:dd:ee:ff;
  fixed-address 10.0.50.10;
}

Without the explicit mac address, I still ran into issues where 10.0.50.11 (or others) where assigned to the printer.

Question Is there a better way to ensure that only one - and always the same - IP address is provided by my DHCP?

1
  • Put the host inside the subnet scope and do not use a fixed address from the range. Also, you don't have to specify a dynamic range if you don't need to use one. Commented Mar 18, 2016 at 20:33

1 Answer 1

1

As a general rule, I tend to keep ephemeral addresses and fixed addresses separate. For example, I have a basic network using 192.168.0.110-199 for clients, and then everything up to 109 is available for static - including those assigned by DHCP. (The strange numbers here are because I'd already declared that network printers would all get IPs in the 101-109 range.) So the config looks something like this:

subnet 192.168.0.0 netmask 255.255.255.0 {
  range 192.168.0.110 192.168.0.199;
  option routers 192.168.0.10;
  # thresholdrpg.com
  option static-routes 64.253.105.42 192.168.0.11;
}
host yosemite {
   hardware ethernet aa:bb:cc:dd:ee:ff;
   fixed-address 192.168.0.14;
}
host hippo {
   hardware ethernet 00:11:22:33:44:55;
   fixed-address 192.168.0.103;
}

dhcpd is quite happy to give out addresses that aren't in the 'range', though of course still within the subnet. In your case:

subnet 10.0.50.0 netmask 255.255.255.224 {
    range 10.0.50.12 10.0.50.15;
}

There's now no way that any other client will be given .10 or .11; only an explicit "host" block will set that.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.