I’ve been setting up a new server at hetzner.de.
I ran into problems when configuring the network. The server is running Debian (wheezy).
The basic configuration looked like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## /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 |
This should work, as mentioned in the Hetzner DokuWiki.
I added DNS servers at the end (use your DNS servers here or pick an open DNS server)
1 | dns-nameservers X.X.X.X Y.Y.Y.Y |
at the end since I’ve resolvconf installed.
eth0 did not come up correctly.
When trying ‘ifdown eth0; ifup eth0’ I kept getting:
1 2 3 | ifdown: interface eth0 not configured RTNETLINK answers: File exists Failed to bring up eth0. |
This error would show up at boot time or when trying to start eth0 by hand.
The setup would look fine otherwise, IP was correct network seemed to work, but the DNS-servers were not added correctly. Weird!
‘ifdown –force eth0; ifup eth0’ worked. Server went off for a second but came back. with DNS-servers setup correctly. Interesting!
I started to comment out lines from /etc/network/interfaces.
Et voilá!
It turns out: It is deadly to try to configure ‘gateway’ in /etc/network/interfaces!
Finally I used this:
1 2 3 | ## /etc/network/interfaces working Hetzner root server auto lo iface lo inet loopback |
auto eth0
iface eth0 inet static
address 192.168.0.250
netmask 255.255.255.255
# next line optional
network 192.168.0.0
## never EVER use the next line! you have been warned!
## gateway 192.168.0.1
pointopoint 192.168.0.1
dns-nameservers X.X.X.X Y.Y.Y.Y
I hope this post will save others some time to fix this issue with their setup.