Setup Proxmox in Routed Mode with multiple IPs

noxomix
4 min readAug 12, 2023

--

Suppose you have a hosting company and you want to provide Proxmox Virtual Machines (VMs) with their own IP addresses. First and foremost, you need to set up your Proxmox instance on a server.

The Setup:
I used a Hetzner Cloud Server for this purpose. I set up a Debian 12 Cloud Server with 4GB of RAM. Next, I followed the official installation guide for installing Proxmox VE on Debian, which can be found at: here. While following this guide, I encountered an error during the Proxmox installation process. The installation froze at 77 percent progress. This issue arose due to the Cloud-Init Configuration of Hetzner Cloud. To address this, I had to disable the automatic configuration by following this tutorial. Once this was completed, I proceeded to remove the configuration file from the system/etc/network/interfaces.d (rm /etc/network/interfaces.d/*).
Before we can reboot - we need to configure our eth0 interface:

nano /etc/network/interfaces

because otherwise our Cloud Server does not have any network access after the reboot.
So into our /etc/network/interfaces file we write the following:
(make sure to replace <YOUR-PRIMARY-IP> and <YOUR-PRIMARY-IPV6>!)

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address <YOUR-PRIMARY-IP>/32
gateway 172.31.1.1 #hetzner default gateway
dns-nameservers 8.8.8.8 8.8.4.4

iface eth0 inet6 static
address <YOUR-PRIMARY_IPV6>::/64
gateway fe80::1 #hetzner default ipv6 gateway

After that we update our network interface by typing: ifup eth0
Now we can reboot our Hetzner Server. And hopefully the server would work then. So if its not reachable via ssh after the reboot, you need to look into configuration again.

Now we can continue our Proxmox installation like described. And now the “warning: interrupt lo duplicate” error should have been gone.

If Proxmox Webpanel is reachable via https://<YOUR-PRIMARY-IP>:8006/ you can be proud of yourself since the Host is now working :D.

— Routed network configuration in Proxmox —

But … yea we still need to configure our Proxmox Host to let the VMs and CTs connect to the internet with their own public IP.
For this we need an additional IP first (of course you can also use internal network, but we will use an Floating IP for that) the Floating IP may be a little expensive so you should consider not to use Hetzner Cloud for reselling purpose. (In my case its just a testing environment).

The Floating IP is what we configure as additional IP Address to use it for one of the Proxmox CTs (or VMs) as its static public ip.

Usually you can use the Bridged mode to archive this — but Hetzner (and many other Hosting Providers) disallow the use of multiple MAC addresses at one physical interface, which means we need to configure the host in “Routed Mode” to route all the traffic of the VMs through the eth0 interface. This means we need to activate IP Forwarding which is disabled by default (no worries im not talking about NAT or Port->InternalIP configuration).

root@hostnm: sysctl -w net.ipv4.ip_forward=1
root@hostnm: sysctl -w net.ipv6.conf.all.forwarding=1

This two commands will enable it temporary — but it will be disbaled after a reboot, so in addition we enable thoose two lines also at: /etc/sysctl.conf !

After that we need to setup our Bridge (usually called vmbr0) to connect our VMs/CTs to.
So we edit our /etc/network/interfaces again and making sure to fill YOUR-PRIMARY-IP with the Primary IP of your Host and <YOUR-ADDITIONAL-IP> with the Floating IP. The last line may not be required, Since we already activated Port Forwarding.

auto vmbr0
iface vmbr0 inet static
address <YOUR-PRIMARY-IP>/32
bridge-ports none
bridge-stp off
bridge-fd 0
up ip route add <YOUR-ADDITIONAL-IP>/32 dev vmbr0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward

But wait — we are not ready yet. Because we need to tell eth0 to route the traffic to vmbr0. The Proxy ARP describes a mechanism which is used to enable the ability of routing IP traffic outside the own network (eg. additional IP) through the eth0 gatway — for that we need to add a line to our eth0, so scroll up in the file and add following line:

...
auto eth0
iface eth0 inet static
address <YOUR-PRIMARY-IP>/32
gateway 172.31.1.1
dns-nameservers 8.8.8.8 8.8.4.4
#add this line
post-up echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
...

Now we go back to the Hetzner webinterface and reboot our Host.

The only thing left is to configure our VM or CT to use the Floating IP as its static main IP.

— Configure the CTs network —

So lets install one of the LXC Templates on Proxmox, then we continue creating a new LXC Container (CT), in its network config we put our Floating IP in the first field, and notice: our Primaray IP is now our Gateway (!). Like this:

After the creation the LXC Container will be online with its static IP configured as your Floating IP. You can now connect via SSH to your LXC Container (keep in mind: the login into root via ssh is disabled by default, so maybe add a new user via the VNC first).

If this configuration is not working for you:
Leave the IP fields blank when creating new Container. Then log into your Container and edit the /etc/network/interfaces like this:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address <YOUR-ADDITIONAL-IP>/32
pointopoint <YOUR-PRIMARY-IP>
gateway <YOUR-PRIMARY-IP>

After restarting the CT it should work.

I hope this guide helps you. Since there are so many different tutorials and everyone says something else, this one is the only one worked for me. Best Regards Theo.

--

--

Responses (5)