Configuring IPv6 on Linux
Enabling IPv6 on Ubuntu 22.04
To enable IPv6 on an Ubuntu 22.04 system, follow these steps:
- Open the terminal and check the current IPv6 status:
ip -6 addr
If no IPv6 addresses are displayed, IPv6 is likely disabled.
- Edit the network configuration file:
sudo nano /etc/sysctl.conf
- Uncomment the following line (or add it if it's not present):
net.ipv6.conf.all.disable_ipv6 = 0
-
Save the file and exit the editor.
-
Apply the changes:
sudo sysctl -p
- Verify that IPv6 is now enabled:
ip -6 addr
You should see one or more IPv6 addresses assigned to your network interfaces.
Configuring a Static IPv6 Address
To configure a static IPv6 address, follow these steps:
- Open the network configuration file for the desired interface:
sudo nano /etc/netplan/00-installer-config.yaml
- Add the following configuration block, replacing
<ipv6_address>
and <prefix_length>
with your desired values:
network:
version: 2
ethernets:
<interface_name>:
dhcp6: no
addresses:
- <ipv6_address>/<prefix_length>
-
Save the file and exit the editor.
-
Apply the changes:
sudo netplan apply
Your static IPv6 address should now be configured on the specified interface.
Verifying IPv6 Connectivity
To verify IPv6 connectivity, you can use the following commands:
ping6 ipv6.google.com
traceroute6 ipv6.google.com
These commands will test the connectivity to an IPv6 host, providing information about the network path and response times.