To configure a static IPv6 address with a static IPv6 gateway without using SLAAC alongside a IPv4 address that is being obtained via DHCP on Ubuntu using netplan, follow these steps:

  1. Open the /etc/netplan/01-netcfg.yaml file in a text editor.
  2. Add the following lines to the file, replacing the placeholder values with your own settings:
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: true
      dhcp6: false
      addresses:
        - <IPv6 address>/<IPv6 netmask>
      gateway6: <IPv6 gateway>
  1. Save the file and exit the text editor.
  2. Apply the changes by running the following command:
$ sudo netplan apply


Your Ubuntu system should now be configured with a static IPv6 address and gateway, while still obtaining its IPv4 address via DHCP.