Skip to content

Instantly share code, notes, and snippets.

@DonSYS91
Last active January 4, 2024 10:25
Show Gist options
  • Save DonSYS91/03623c2b8270fd05a76a436c55b95c50 to your computer and use it in GitHub Desktop.
Save DonSYS91/03623c2b8270fd05a76a436c55b95c50 to your computer and use it in GitHub Desktop.
Configuring IPv6 block from Online.net On Proxmox Host and Guests

Configuring IPv6 block from Online.net On Proxmox Host and Guests

Following the documentation on online.net would get IPv6 to work only in a simple system installation but won't get IPv6 to work with virtualization environment (Exp. Proxmox) as It's missing some IPv6 forwards and proxies on sysctl.conf.

On Proxmox Host (Or Debian if single Debian Installation)

Enable IPv6 on the System:

  • Change Module Options to Enable IPv6:

In the following file:

/etc/modprobe.d/local.conf

enable IPv6 by changing the 1 to 0:

options ipv6 disable=0
  • Load IPv6 Kernel Module at the boot: Edit the following file:
/etc/modules

Add ipv6:

ipv6
  • Reboot the server to load IPv6 Modules

Now the system has IPv6 modules loaded and enabled, we need to configure and allow IPv6 forwarding.

Note: You can skip this step if you have simple Debian installation without Virtualization.

  • Enable Forwarding by adding them into the system variables:

Edit the system variables file:

/etc/sysctl.conf

Disable autoconf for ipv6 on interface vmbr0, enable forwards on default interface and all other interfaces, enable NDP proxy on default and all interfaces, as the following:

net.ipv6.conf.vmbr0.autoconf = 0
net.ipv6.conf.vmbr0.accept_ra = 2

net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1

net.ipv6.conf.default.proxy_ndp = 1
net.ipv6.conf.all.proxy_ndp = 1

Read the new system variables, by executing the command:

sysctl -p

At this point we enabled IPv6 on the system by loading the required modules, and enabling forwarding and ndp proxy on the host, so that our guest machines can obtain IPv6 addresses from the host.

Configuring the IPv6 Client

We will use the default DHCP client to issue and get the IP Block from the router using DUID given in online.net console.

Edit or create the following file if not exists:

/etc/dhcp/dhclient6.conf

Add the following lines:

interface "vmbr0" {
   send dhcp6.client-id DUID;
}

Where vmbr0 represents the main interface, and DUID obtained from Online.net IPv6 Panel.

Configuring Interfaces file to add IPv6 address and run the dhclient6

Edit the interfaces file:

/etc/network/interfaces

And add the following lines:

iface vmbr0 inet6 static
    address YOUR_IPv6
    netmask YOUR_SUBNET
    accept_ra 1
    pre-up dhclient -cf /etc/dhcp/dhclient6.conf -pf /run/dhclient6.vmbr0.pid -v -nw -6 -P vmbr0
    pre-down dhclient -x -pf /run/dhclient6.vmbr0.pid

Note: YOUR-IPv6 is the created subnet from online.net IPv6 panel, for example:

iface vmbr0 inet6 static
    address 2001:bc8:50ca:101::1
    netmask 64
  • Reboot the server, and your server should get IPv6 address now.

IPv6 On Proxmox Container:

  • On Proxmox GUI, create new network device, use vmbr0 as bridge.
  • Enter the desired IPv6 from your IPv6 block but not the one that's taken from host (Exp. 2001:bc8:50ca:101::2/64)
  • Enter the IPv6 of the host as gateway (2001:bc8:50ca:101::1).
  • Enter DNS server, exp. Google Public DNS: 2001:4860:4860::8888 and 2001:4860:4860::8844

After Rebooting the container it should have an IPv6 connectivity and connection to the internet.

IPv6 On Proxmox VM:

  • On Proxmox GUI, from Hardware windows edit the current IPv4 network device to IPv6 to it (only if it uses vmbr0 as Bridge, if it's on other bridge then create new network device).
  • Start the VM
  • Edit the interfaces file on the VM, /etc/network/interfaces
  • Add IPv6:
iface ens18 inet6 static
        address 2001:bc8:50ca:101::3
        netmask 64
  • restart the networking service networking restart or reboot the VM.

Known Problems:

  • The host loses IPv6 address after rebooting or after some time (an hour). checking the interface IPs:
ip a show vmbr0

If you notice that inet6 where our IPv6 is assigned is gone, then you have this problem, to fix the issue temporary, issue new IP:

ip -6 a a 2001:bc8:50ca:101::1/64 dev vmbr0

Now test the Connectivity:

ping6 ipv6.google.com

Note: that you need to do this everytime you restart the host.

The reason for this problem, may be due to this line in /etc/network/interfaces:

iface vmbr0 inet6 static
    address 2001:bc8:50ca:101::1
    netmask 64
    accept_ra 1
    pre-up dhclient -cf /etc/dhcp/dhclient6.conf -pf /run/dhclient6.vmbr0.pid -v -nw -6 -P vmbr0
    pre-down dhclient -x -pf /run/dhclient6.vmbr0.pid

The system is trying to assign IPv6 but the pre-up phase hasn't been touched yet (timing problem), the pre-up line should be finished so the system can pull the IPv6 block from the router.

Still Investigating the issue.

@DonSYS91
Copy link
Author

this configuration is for Proxmox 5?

Sorry missed your question since long time, yes at that time it was for PVE5

@warlof
Copy link

warlof commented Jan 5, 2020

Hi @donmccoy,

I just found that gist which I'm using to setup my own proxmox at Online.
Did you figure why the server didn't get its IPv6 after boot and find a way to fix it ?

@DonSYS91
Copy link
Author

DonSYS91 commented Jan 5, 2020

Hi @warlof,

I remember i solved the problem, too bad i didn't update my gist and since then i ditched online for hetzner.

I hope i can find an Online.net server lying around to test the possible solution

@kamzata
Copy link

kamzata commented May 8, 2020

Hi @warlof,

I remember i solved the problem, too bad i didn't update my gist and since then i ditched online for hetzner.

I hope i can find an Online.net server lying around to test the possible solution

I'm with Online/Scaleway (Dedibox Pro series) since 2013 but I'm thinking to moving to Hetzner. 1 year ago I tried to setup IPv6 on my Dedibox with Proxmox but it didn't work 'cause a Online.net IPv6 network problem. Anyway... how is the Hetzner server? Better than Online.net? Are you happy of migration? I was thinking to take an AX51-NVMe...

@aminvakil
Copy link

@donmccoy
So this documentation works for hetzner servers?

@shubhank008
Copy link

Do anyone has a fix for online.net problem yet ? Super annoying

@shubhank008
Copy link

For anyone dealing with ipv6 issue on online.net + proxmox using LXC container, after reboot if ipv6 don't work, execute these commands on your host (replace with your ipv6)

dhclient -cf /etc/dhcp/dhclient6.conf -pf /run/dhclient6.vmbr0.pid -v -nw -6 -P vmbr0
ip -6 a a 2001:bc8:50ca:101::1/64 dev vmbr0

@DonSYS91
Copy link
Author

DonSYS91 commented Dec 3, 2021

Funny enough, I didn't tinker with IPv6 in a long time and landed here again when i googled, haha.
@aminvakil I'm acutally doing it now for Hetzner dedi.
@shubhank008 thanks for the input, I think i should include this in my write up

@al-tonio
Copy link

al-tonio commented Dec 4, 2022

I had an issue on my scaleway start-2-S-SATA server where ipv6 would not be setup after boot, but ifup --force enp1s0 would set it up properly later without issue.

After some debugging my conclusion was that there was a race condition as the kernel did not setup the ipv6 link address until after dhcp was launched, which caused dhcp to fail. (look for when "IPv6: ADDRCONF(NETDEV_CHANGE): link becomes ready" arrives in journalctl --boot )

I fixed it by having this "sleep 8" in my /etc/network/interfaces
pre-up sleep 8; dhclient -cf /etc/dhcp/dhclient6.conf -pf /run/dhclient6.enp1s0.pid -v -nw -6 -P enp1s0
pre-down dhclient -x -pf /run/dhclient6.enp1s0.pid

Now ipv6 is properly setup after reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment