Simple setup IPv6 in Proxmox for LXC or VM in Hetzner

Bl1c

Member
Aug 15, 2023
9
9
8
Ukraine
For each server, Hetzner provides free IPv6 subnets /64
Using Hetzner as an example IPv6 provider, here is a configuration example.

Okay, now we have an allocated subnet range::/64
For example, range:: = 2a49:8d8:112:7se1::

Edit Proxmox configuration:​

nano /etc/network/interfaces

Physical interface​

For the physical interface enp6s0, add IPv6 settings.
address - assign an IP from the allocated /64 subnet.
gateway - specify the allocated gateway. This is the link-local address of the IPv6 provider’s router through which the node can access the global network.
For example: router::1 = fe80::1
iface enp6s0 inet6 static
address range::2/64
gateway router::1

Linux Bridge​

For an existing or separate Linux Bridge, add IPv6 settings.
range::3 - assign an IP from the allocated /64 subnet.
iface vmbr0 inet6 static
address range::3/64

Add routes for VM or LXC​

range::4 - on the VM or LXC, use an IP from the allocated /64 subnet.
up ip -6 route add range::4 dev vmbr0
up ip -6 route add range::/64 via range::4 dev vmbr0

After changes in <em>nano /etc/network/interfaces</em>, reload all network interfaces without breaking the connection.
ifreload -a

Enable forwarding​

Enable IPv6 forwarding in the node console:
echo "net.ipv6.conf.all.forwarding=1" >> /etc/sysctl.conf
sysctl -p

VM or LXC​

Use the IP for which the routes were created. The gateway is the Linux Bridge vmbr0.
address range::4/64
gateway range::3

I used the /64 mask everywhere — everything will also work if you use /128 in some places.