====== Hetzner QEMU/KVM Server Setup ======
Hetzner has a //very// unique way of assigning additional IP ranges to their dedicated server, which, in order to use these IPs for a virtual machine server, requires a virtual bridge.
=== Kernel Options ===
Take a look at ‘/etc/sysctl.conf’ and make sure that the following two lines aren’t commented out:
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
=== Host ifconfig ===
auto lo
iface lo inet loopback
iface lo inet6 loopback
# Main physical NIC
auto eth2
iface eth2 inet static
address 95.216.45.147
netmask 255.255.255.192
gateway 95.216.45.129
up route add -net 95.216.104.224/28 netmask 255.255.255.240 gw 95.216.45.147 eth2
# Bridge NIC for VMs
# Source: https://blog.no-panic.at/2016/08/09/proxmox-on-debian-at-hetzner-with-multiple-ip-addresses/
auto virbr1
iface virbr1 inet static
address 95.216.45.147
netmask 255.255.255.255
bridge_ports none
bridge_stp off
bridge_fd 0
bridge_maxwait 0
pre-up brctl addbr virbr1
up ip route add 95.216.104.224/28 dev virbr1
up ip route add 95.216.104.225/28 dev virbr1
=== Guest ifconfig ===
auto ens3
iface ens3 inet static
address
netmask 255.255.255.240
dns-nameservers 1.1.1.1
post-up ip route add 95.216.45.147 dev ens3
post-up ip route add default via 95.216.45.147 dev ens3
post-down ip route del default via 95.216.45.147 dev ens3
post-down ip route del 95.216.45.147 dev ens3
=== KVM Config ===
Add to KVM config via "$ virsh edit " place in the devices section
'/>
# virtio works here too