Linux – IPv6 public routing of virtual machines from host

gentooipv6linuxovhxen

So I have a dedicated server from OVH. With that I got a /64 range of IPv6 addresses and 1 public IPv4 address. I purchased a second IPv4 address as a fallback.

The host is running the Xen hypervisor and I already set up the bridge

bridge name bridge id       STP enabled interfaces
br0     8000.0cc47ac4292c   no      eno3
                                    vif4.0
                                    vif4.0-emu
virbr0  8000.525400a2390a   yes     virbr0-nic

I was able to get the VM connected with both the IPv4 and IPv6 address (it will only be using IPv6 though) however as a test I changed the VM's MAC address from the one listed for my fallback and boom, no more IPv6 connectivity but once I set the MAC address back it was working right as rain.

Host ipv6 routing table

2607:5300:61:45b::/64 dev br0  proto kernel  metric 256  pref medium
2607:5300:61:400::/56 dev eno3  proto kernel  metric 202  mtu 1500 pref medium
fe80::/64 dev eno3  proto kernel  metric 256  pref medium
fe80::/64 dev eno4  proto kernel  metric 256  pref medium
fe80::/64 dev br0  proto kernel  metric 256  pref medium
fe80::/64 dev vif4.0-emu  proto kernel  metric 256  pref medium
fe80::/64 dev vif4.0  proto kernel  metric 256  pref medium
ff00::/8 dev eno3  metric 256  pref medium
ff00::/8 dev eno4  metric 256  pref medium
ff00::/8 dev br0  metric 256  pref medium
ff00::/8 dev vif4.0-emu  metric 256  pref medium
ff00::/8 dev vif4.0  metric 256  pref medium
default via fe80::205:73ff:fea0:0 dev br0  metric 1024  pref medium

Guest ipv6 routing table

2607:5300:61:45b::/64 dev eth0  proto kernel  metric 256  pref medium
2607:5300:61:400::/56 dev eth0  proto kernel  metric 256  expires 2591946sec pref medium
fe80::/64 dev eth0  proto kernel  metric 256  pref medium
default via fe80::205:73ff:fea0:0 dev eth0  proto ra  metric 1024  expires 1746sec hoplimit 64 pref medium

Ideally what I'm looking to do is be able to create VM's that will have their own publicly routable IPv6 address without having to have a separate fallback IPv4 address for each one.

The host system is running Gentoo btw.

Best Answer

I created my own solution where I created a PFSense firewall which will handle the natting of the single IPv4 address and allocate out globally routable IPv6 addresses. (Currently working on a separate issue with the setup but full IPv6 connectivity works just fine.)

To do the setup, create a separate bridge off the host machine (br1) and connect PFSense to both br0 and br1 WAN/LAN respectively. Have all your virtual machines bridge to br1 which will then receive a private IPv4 address and public IPv6 address from DHCP.

Related Topic