Setting up networking in Proxmox on an OVH server with only one IPv4 address
published on
To be clear: These instructions will give each virtual machine you create an IPv6 address. This will be how your machines predominately connect with the rest of the internet. However, they will have access to the IPv4 address of the host should they need it. Incoming traffic will not be able to connect to your virtual machine through the IPv4 address.
Setting up the host machine
Make a backup of your /etc/network/interfaces file, comment out any inet6 section already present and add the following:
iface vmbr0 inet6 static address 2001:41d0:800:269::ffff/128 post-up sleep 5; /sbin/ip -6 route add 2001:41d0:800:2ff:ff:ff:ff:ff dev vmbr0 post-up sleep 5; /sbin/ip -6 route add default via 2001:41d0:800:2ff:ff:ff:ff:ff pre-down /sbin/ip -6 route del default via 2001:41d0:800:2ff:ff:ff:ff:ff pre-down /sbin/ip -6 route del 2001:41d0:800:2ff:ff:ff:ff:ff dev vmbr0 auto vmbr6 iface vmbr6 inet static address 10.0.0.254/24 bridge-ports none bridge-stp off bridge-fd 0 post-up echo 1 > /proc/sys/net/ipv4/ip_forward post-up iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o vmbr0 -j MASQUERADE post-down iptables -t nat -D POSTROUTING -s 10.0.0.0/24 -o vmbr0 -j MASQUERADEiface vmbr6 inet6 static address 2001:41d0:800:269::1/64
Make sure to replace the IP addresses in the first section above with the IPv4 and gateway addresses that OVH have given you.
Once you have finished editing the file run sudo ifup vmbr6 and then sudo ifreload -a.
Now add the following lines to your /etc/sysctl.conf file:
net.ipv6.conf.all.forwarding = 1
Install ndppd
Setting this up will allow all of your guest machines to communicate with the internet at the same time.
Install ndppd with sudo apt install ndppd then add the following commands to the /etc/ndppd.conf file:
route-ttl 30000proxy vmbr0 { router yes timeout 500 ttl 30000 rule 2001:41d0:8:aaaa::/64 { static }}
Change the address above to same one as your vmbr0 inet6 address (without the last section).
Setting up the guest machines
When creating your guest machines make sure to use an IPv4 address of 10.0.0.x/24 (where x can be any number other than 254 and anything already allocated to another machine) and a gateway of 10.0.0.254. The bridge should be set to vmbr6.
Use an IPv6 address of 2001:41d0:800:269::x/64 (using the above example but make sure to change your IPv6 address to suit what OVH already gave you). Make sure that x is any number other than 1 or anything already used with another machine. The gateway should be 2001:41d0:800:269::1 (remembering the above about your IPv6 address).
Having problems?
You likely will need to make sure that you turn off the firewall in the Proxmox guest set up. However, inside the guest you will need to enable a firewall for the IPv6 address.
Conclusion
You should now have working guest machines that are allocated unique Pv6 addresses but are able to use the IPv4 address for outbound connections only.
It will be much easier if you purchase extra IPv4 addresses instead of using this method. However, if you choose not to you can, at least, create virtual machines without proper IPv4 access.
