Configure Proxmox to use multiple IP addresses in Hetzner
Proxmox is an open-source server management platform for virtualization that runs a KVM hypervisor and an LXC hypervisor. If you plan to host public services, you should have an additional IP address; otherwise, you would need to manually forward traffic from the host to the VM/LXC.
Configuring Proxmox
You can forward traffic directly to your Container/VM with additional IP addresses. There are two ways to do this: Routed Configuration: With this method, a virtual bridge for every additional IP address is set up in the network configuration and can be used later in a container/VM. Bridged Configuration: The guest system behaves independently. Proxmox automatically routes all packets to the guest system by assigning a MAC address to the guest system's virtual network card. Hetzner provides a sample configuration for the routed configuration, but also for the bridged configuration with bridged configuration, you specify with the MAC address which IP address to use. With this option, you are flexible with the number of IP addresses you have.
Network Configuration
Open your network configuration under /etc/interfaces
.
# remove or disable configuration for eth0
#auto eth0
#iface eth0 inet static
auto vmbr0
iface vmbr0 inet static
address <MainIP>
broadcast <Broadcast>
gateway <Gateway>
bridge-ports eth0
bridge-stp off
bridge-fd 1
bridge-hw eth0
pointopoint <Gateway>
# Public IP
auto vmbr1
iface vmbr1 inet static
address 10.0.0.1/24
bridge-ports none
bridge-stp off
bridge-fd 0
# Local network
The configuration above is an extension of the recommended configuration from Hetzner. We are using two bridges. vmbr0 is a public bridge where you can later define which IP address you want to traffic. The second interface, vmbr1, is a private network between containers. To use your additional IP address, you first must request a MAC address for your extra IP in your Hetzner Account. Create a new VM/LXC, continue until the network tab, enter the MAC address there, and select vmbr0 as a bridge. The host will then route all traffic designated to the additional IP to your VM/LXC!