Mix Static and Dhcp Addresses on the Same Interface in Ubuntu 18.04

Original –

Ubuntu 18.04 uses netplan to configure the network. All my servers run behind an OPNSense Firewall that runs a DHCP server for IPv4 and has static leases applied.

Since I don't run a IPv6 DHCP server, I have to configure IPv6 manually on all my servers. I did some research to figure out how to get it working with netplan. And guess what, it is easier than I thought.

network:
  ethernets:
    ens18:
      dhcp4: yes
      dhcp6: no
      addresses:
       - <IPv6 address>
      gateway6: <IPv6 gateway address>
  version: 2

I think the setup is pretty self explainary but let me explain it to you. First we enable dhcp for IPv4 and disable dhcp for ipv6.

dhcp4: yes
dhcp6: no

In the last step we apply the fixed ipv6 address and save the file. After a reboot, the server should have the correct ip addresses. Terms