There are two key methods of IP assignment in a network, both with their advantages and disadvantages. These are 'DHCP' (Dynamic Host Configuration Protocol) and 'Static assignment'. This is the case in any network and is in no way unique to the Unifi environment. You can mix both methods on any network/VLAN.
Almost all gateways will have a built in DHCP server, including Unifi gateways.
Most people will be happy with the DHCP method, where the DHCP server automatically hands out IPs from a pool. . .
- Low maintenance, easy configuration.
- No need to set the IP on client devices (mobile phones etc)
- The IP changes over time, making it harder to identify a device on the network
- You cannot port forward reliably
- Firewall controls can only be applied to pools of IPs
Some people will benefit from setting static IPs on certain devices. For example, if you are running some kind of webs server on your network, such devices ordinarily must retain their IP. The IP can either be 'reserved' in the pool for that device, or have it's IP hard coded on the device's interface. . .
- You always know what the device IP will be
- Port forwards can be set up and will remain valid because the IP never changes
- Much finer grained firewall controls can be applied to specific devices
- More time consuming to configure
- Error prone
- You need to keep a list of what IPs are assigned to what clients and be very careful not to assign the same IP to more than one device
Unifi Gatway vs Third Party Gateway
If you are using a Unifi gateway (USG, USG-Pro-4 models etc) then you will be assigning IPs via your Hubox controller. Out-of-the-box, the gateway will be giving all devices, clients, switches, access points, whatever, dynamic IPs from it's internal server. IPs are associated with the device MAC address, the details of which are easily visible in the controller. . .
. . . click on any device you wish to set a static IP, click the gear icon, click Network, and the IP assignment options become visible. . .
As a bare minimum, you will need to set the IP (obviously), the subnet mask, the gateway address, and the DNS address (you can use the gateway address here as in the example above, or a third party DNS such as Google's 22.214.171.124).
Don't change the IP address of the gateway itself by the way, unless you really know what you're doing.
Click Queue Changes, then Apply Changes, the device will reprovision and come back up with it's new IP.
If you are using a non-Unifi gateway, you will not be able to set the IP via your Hubox controller. You must refer to your gateway vendor's own instructions as this is beyond the scope of this article.