According to official Hetzner documentation:
Our standard images already come with this configuration so that all traffic is routed via the gateway.
And then followed by example:
## /etc/network/interfaces example Hetzner root server
# Loopback-Adapter
auto lo
iface lo inet loopback
#
# LAN interface
auto eth0
iface eth0 inet static
# Main IP address of the server
address 192.168.0.250
# Netmask 255.255.255.255 (/32) independent from the
# real subnet size (e.g. /27)
netmask 255.255.255.255
# explicit host route to the gateway
gateway 192.168.0.1
pointopoint 192.168.0.1
It seems that installimage script behave incorrectly, because after installing official Hetzner Debian image I see:
root@server ~ # cat /etc/network/interfaces
### Hetzner Online GmbH installimage
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
iface lo inet6 loopback
auto eno1
iface eno1 inet static
address 1.2.3.104 # 1.2.3 is my censor :)
netmask 255.255.255.192
gateway 1.2.3.65
# route 1.2.3.64/26 via 1.2.3.65
up route add -net 1.2.3.64 netmask 255.255.255.192 gw 1.2.3.65 dev eno1
iface eno1 inet6 static
address XXX::2
netmask 64
gateway fe80::1
root@server ~ # ip r
default via 1.2.3.65 dev eno1 onlink
1.2.3.64/26 via 1.2.3.65 dev eno1
1.2.3.64/26 dev eno1 proto kernel scope link src 1.2.3.104
Instead of config I see on Ubuntu 24.04 for comparison (also from installimage):
root@another-server ~ # ip r
default via 5.6.7.1 dev enp7s0 proto static onlink
This later causes issues with automation like Ansible, because Ansible reads current network setup, and sees that the netmask is /32 instead of whatever is needed. And then breaks network configuration because it's not aware of weird up route (we have quite weird setup and we're just replacing whole /etc/network/interfaces with our config)
According to official Hetzner documentation:
And then followed by example:
It seems that
installimagescript behave incorrectly, because after installing official Hetzner Debian image I see:Instead of config I see on Ubuntu 24.04 for comparison (also from installimage):
This later causes issues with automation like Ansible, because Ansible reads current network setup, and sees that the netmask is /32 instead of whatever is needed. And then breaks network configuration because it's not aware of weird
up route(we have quite weird setup and we're just replacing whole/etc/network/interfaceswith our config)