Static DHCP

Started by jmcgee, November 16, 2020, 10:55:42 PM

Previous topic - Next topic
November 16, 2020, 10:55:42 PM Last Edit: November 16, 2020, 11:48:38 PM by jmcgee
I recently installed Opnsense on a Qotom machine.  It installed fine and is working.   I want to assign MAC addresses of devices to static DHCP.  I have google, read docs, searched forum  Where do I do this;
I am running:
OPNsense 20.7.4-amd64
FreeBSD 12.1-RELEASE-p10-HBSD
OpenSSL 1.1.1h 22 Sep 2020

It's a fairly standard install, 1 WAN port, 2 LAN ports, no vlan.

Hi, you will find this on Services > DHCPv4 or 6 > [INTERFACE NAME]
You have to turn on DHCP service and fill the automatic address assignment range.
Then, at the bottom, you'll find a list to add MAC-IP mappings.

Perfect. Found it.  Question.
I assumed DHCP static mapping would map MAC addresses to IP number within the DHCP range.
I have told DHCP to use range 192.168.1.5 to 192.168.1.100.

If I try to use address 192.168.1.16 it says
The following input errors were detected:
    The IP address must not be within the DHCP range for this interface.

I can give it 192.168.1.108 and it works.

Your static mappings need to be outside of the range chosen for auto mapping.

Quote from: TomK on November 17, 2020, 02:23:57 AM
Your static mappings need to be outside of the range chosen for auto mapping.

Yeah, I would say there are at least 2 approaches:

1 is that I got used to in the past 10+ years is that you have a DHCP range. If you want, you can  enable some DHCP clients to be "reserved". What that means, you make the IP address assignment bound to the MAC address. Now thats what opnsense NOT does.

The other option, what Opnsense does, that you create a generic DHCP range, anything that gets served from that range will be dynamic. If you want a DHCP client to be static, you have to create a MAC address-IP address mapping outside of that range.

I have an open PR: https://github.com/opnsense/core/pull/4447

This limitation is from the past. It's not needed anymore. I hope in one of the next releases my PR will be merged.
,,The S in IoT stands for Security!" :)