Looking to use static IP addresses with the DHCP provided by Ubiquiti USG? The Unifi controller web UI does have the very basic capability to add static DHCP entries but it's clunky and the host needs to be active on the LAN -- using the UI, there's no way to add a static DHCP entry beforehand.
This article covers how to configure static DHCP entries on the Ubiquiti USG (UniFi Security Gateway 3P version 4.4.22.5086045) before the hosts are added to the LAN. Interestingly, the configuration persists a reboot but probably not a full reprovision (I haven't tested this -- I'll keep the cli commands handy in case of reset).
If the Unifi GUI was used to configure static IP addresses, I encountered a bug where the CLI allows a duplicate entry to be created so that the DHCP service fails to start. So please check existing entries before creating new ones (inspect the output of show service dhcp-server shared-network-name
).
So high level we'll connect to the USG, determine its network configuration name, and add new entries. Then commit and save.
-
ssh
to the USG, which is not the Unifi controller. -
On the USG, execute
configure
to enter the configuration mode. Note that settings do not persist a reboot untilcommit
ed. -
Determine the 'shared-network-name' of the LAN using
show service dhcp-server shared-network-name
. Mine isnet_LAN_10.1.1.0-24
. -
For each host determine these items:
- MAC address
- Desired IP address outside of the DHCP (dynamic) range
- Hostname and domain
-
Create static DHCP entries (and their DNS host mappings) using MAC, IP, hostname with this template:
set service dhcp-server shared-network-name net_LAN_10.1.1.0-24 subnet 10.1.1.0/24 static-mapping <HOSTNAME> ip-address <IPADDR> set service dhcp-server shared-network-name net_LAN_10.1.1.0-24 subnet 10.1.1.0/24 static-mapping <HOSTNAME> mac-address '<MAC>' set system static-host-mapping host-name <HOSTNAME>.<DOMAIN> inet <IPADDR> set system static-host-mapping host-name <HOSTNAME>.<DOMAIN> alias <HOSTNAME>
- Here's what adding a single host looks like:
set service dhcp-server shared-network-name net_LAN_10.1.1.0-24 subnet 10.1.1.0/24 static-mapping freenas ip-address 10.1.1.230 set service dhcp-server shared-network-name net_LAN_10.1.1.0-24 subnet 10.1.1.0/24 static-mapping freenas mac-address 'aa:bb:cc:dd:ee:ff' set system static-host-mapping host-name freenas.lan inet 10.1.1.230 set system static-host-mapping host-name freenas.lan alias freenas
- Here's what adding a single host looks like:
-
commit
-
save
-
And finally reboot.
That's all there is to it, at this time. Enjoy the USG.