Enable IPv6 on Ubuntu
Activating IPv6 on your system typically involves ensuring that your network infrastructure and configuration support IPv6 connectivity. Here’s a general guide on how to activate and configure IPv6 on Linux, which should help you enable IPv6 connectivity for your Docker environment:
Enable IPv6 on Linux
1. Check Current IPv6 Support
First, verify if IPv6 is already enabled on your Linux system:
cat /proc/sys/net/ipv6/conf/all/disable_ipv6
If the output is 0
, IPv6 is enabled. If it’s 1
, IPv6 is disabled.
2. Enable IPv6 Temporarily
To enable IPv6 temporarily (until next reboot):
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
3. Enable IPv6 Permanently
To enable IPv6 permanently, edit the /etc/sysctl.conf
file:
sudo nano /etc/sysctl.conf
Add or uncomment the following line to enable IPv6:
net.ipv6.conf.all.disable_ipv6 = 0
Save and close the file. Then apply the changes:
sudo sysctl -p
4. Check IPv6 Configuration
Verify that IPv6 has been enabled:
ip a
You should see IPv6 addresses listed along with IPv4 addresses for your network interfaces.
Docker IPv6 Configuration
1. Docker Daemon Configuration
Edit Docker daemon configuration (/etc/docker/daemon.json
or /etc/default/docker
) to enable IPv6 support:
{
"ipv6": true,
"fixed-cidr-v6": "<IPv6 subnet>",
"default-address-pools":
[
{"base":"<IPv6 subnet>", "size":64}
]
}
Replace <IPv6 subnet>
with your desired IPv6 subnet allocation. For example:
-
2001:db8:abcd::/64
2. Restart Docker
After making changes to Docker daemon configuration, restart the Docker service:
sudo systemctl restart docker
3. Verify Docker IPv6 Support
Check Docker network settings to confirm IPv6 support:
docker network inspect bridge
Ensure that IPv6 configuration ("EnableIPv6": true
) is properly set.
Final Steps
-
Test Connectivity: Verify IPv6 connectivity from your Docker containers using tools like
ping6
ortraceroute6
. -
Adjust Firewall Rules: Ensure that firewall rules (e.g.,
ufw
,iptables
) allow IPv6 traffic, especially if you're using firewall rules that might block certain types of traffic.
By following these steps, you should be able to activate and configure IPv6 on your Linux system and Docker environment, enabling IPv6 connectivity for applications and services running within Docker containers. Adjust configurations as per your specific network setup and security requirements.