Setting up an IPv6 only VM
Too many applications are still using IPv4 only, which is a shame as IPv6 was standardised ~28 years ago. If you want to check if your application is IPv6 ready, the best thing is to have a server or docker/podman network which is IPv6 only. I'm showing how to set up both variants here.
Setting up RedHat 10 for IPv6 only
Note: Root access is, of course, required for all these commands.
The following examples use eth0 as the network interface. Use nmcli con show to list the network interfaces and adapt the commands accordingly.
Enabling IPv6
The first step is enabling IPv6:
# enable ipv6
sysctl -w net.ipv6.conf.all.disable_ipv6=0
echo "net.ipv6.conf.all.disable_ipv6=0" | tee /etc/sysctl.d/99-ipv6-enable.conf
# sync to network manager
for DEVICE in $(nmcli con show | grep -v ^NAME | awk '{print $NF}') ; do
nmcli connection reload $DEVICE
nmcli dev reapply $DEVICE
done
nmcli con mod eth0 ipv6.method auto
nmcli con down eth0 && nmcli con up eth0
nmcli is required for all network interfaces, so if you also have eth1, just copy and paste the last two lines for eth1.
Disabling IPv4
Now we need to disable IPv4. First, note down the inet6 address of your network interface. This command shows the IPv6 addresses and filters to globally or site-locally routable addresses only:
ip -6 addr show scope global
Now log out and log in via IPv6 channel, e.g.:
ssh -6 root@<ipv6-address>
This is necessary because when you now disable IPv4 you will lose connectivity to the VM if you are logged in via an IPv4 connection.
Disable IPv4:
nmcli connection modify eth0 ipv4.method disabled
nmcli con down eth0 && nmcli con up eth0
Again, execute the same commands for all other network interfaces. That's it. Now the VM should be using IPv6 for communication only. You can start testing your application.
Setting up an IPv6 podman network
If your application is available as a docker image, you can instead create a docker/podman network with IPv6 only for testing. Simply create an IPv6 podman network by specifying an IPv6 subnet when creating the network:
podman network create --subnet fd00:dead:beef::/64 --gateway fd00:dead:beef::1 ipv6net
Containers started in this network will now get IP addresses starting at fd00:dead:beef::2.
Note: In these examples, I am using the subnet
fd00:dead:beef::. This is a private IP address range, comparable to the192.168.x.xranges in IPv4. You can freely choose anyfd00::/8prefix for your own use.
Use the command podman network inspect <network> to verify the network that has been created:
podman network inspect ipv6net
[
{
"name": "ipv6net",
"id": "37862e16959562d864468dbe251f6a870901bad81981271b179eb8505a93a37c",
"driver": "bridge",
"network_interface":
Comments
No comments yet. Start the discussion.