How to configure IPv6 on Ubuntu
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:
- Open the /etc/netplan/01-netcfg.yaml file in a text editor.
- 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>
- Save the file and exit the text editor.
- 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.