tips:hetzner
This is an old revision of the document!
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 <add new route per IP being used>
Guest ifconfig
auto ens3 iface ens3 inet static address <IP from /28 subnet> 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 <VM name>” place in the devices section
<interface type='bridge'>
<mac address='<generate this with "$ hexdump -vn3 -e '/3 "52:54:00"' -e '/1 ":%02x"' -e '"\n"' /dev/urandom">'/>
<source bridge='virbr1'/>
<model type='rtl8139'/> # virtio works here too
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
tips/hetzner.1580659296.txt.gz · Last modified: 2021/06/18 16:36 (external edit)