To add a static IPv6 address to your Ubuntu Linux system, you need to modify the network configuration file. Here are the steps to add a static IPv6 address:
- Open the
/etc/network/interfacesfile using a text editor. For example:sudo nano /etc/network/interfaces
- Locate the network interface you want to add the static IPv6 address to. For example, if you want to add the static IPv6 address to the
eth0interface, you should see a section similar to the following:auto eth0
iface eth0 inet dhcp
- Add the following lines to the section to add the static IPv6 address:
iface eth0 inet6 static
address <IPv6 address>
netmask <IPv6 netmask>
gateway <IPv6 gateway>
Replace
<IPv6 address>,<IPv6 netmask>, and<IPv6 gateway>with the appropriate values for your network. For example:iface eth0 inet6 static
address 2001:db8:1234::1
netmask 64
gateway 2001:db8:1234::ff
- Save and close the file.
- Restart the networking service to apply the changes:
sudo systemctl restart networking
That’s it. Your Ubuntu Linux system should now be configured with the static IPv6 address you specified.