Fixed IP addresses for servers is obviously a good idea. I have used DHCP assigned permanent reservations as the easiest and most manageable way to use fixed addresses. IP addresses were assigned from a single pool. For me this was usually 192.168.1.101 for 100 addresses. Any DHCP assigned address could simply be tagged as a permanent reservation.
Pfsense changed this. The Pfsense DHCP server can still assign all IP addresses. However, they are “static mappings” rather than “permanent reservations”. The kicker is that the static mappings cannot be in the regular DHCP address pool. Since all my permanent reservations were dispersed throughout the address pool before pfsense, I had to start from scratch with static mappings.
Static IP Addresses
I have a server within the pfsense DHCP pool that needs to have a fixed address. I will assign it on the server and hope that pfsense doesn’t assign it to another device. I will eventually need to correct this.
On my new Ubuntu 18.04 server, I edited /etc/network/interfaces to change the DHCP assigned address to a static IP address as in the past. However, interfaces was empty and I realized I needed to modify /etc/netplan/01-netcfg.yaml. I changed it from this:
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: yes
to this:
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: no
addresses:
192.168.1.199/24
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
The indention is important. Using two spaces works fine. Unfortunately, WordPress removed the indentions from my examples.
Apply the changes with:
$ sudo netplan apply
Verify the changes with:
$ ip addr show dev ens3
To restart networking use:
sudo systemctl restart network-manager