Hetzner debian mirror howto

Network configuration Debian

Main IP address

IPv4

Dedicated root servers

The main IP of a dedicated root server is usually located in a / 26 or / 27 subnet. In order to prevent the accidental use of a foreign IP address, our infrastructure rejects any Ethernet packets that are not addressed to the gateway address. In order to reach a server in the same subnet, our standard images already have a static route in their network configuration. The static route forwards the entire traffic to the subnet via the gateway.

This is not the best solution; Duplicate and inconsistent information appears in the routing table. A better way to reach a server in your subnet is to set the netmask to. The server assumes it is alone in this subnet and will not send any packets directly. However, you now need an explicit host route to the gateway. This is very easy to do with Debian by adding the option in the configuration. Please change to the valid IP address of your gateway.

The additional route to the gateway is now no longer necessary.

IPv6

Dedicated root servers / CX vServers

In principle, the above applies to IPv6 as well. But instead of a single main IP, you get a / 64 block.

As opposed to the IPv4 configuration, there is no "point-to-point" setting in IPv6.

For example:

  • Address block: until
  • We use the first address from this:
  • Gateway:

IPv4 + IPv6

It is expected that over the next few years, IPv4 and IPv6 will be used in parallel. Simply join both configuration files together and with duplicate entries.

Dedicated root servers

Virtual servers

Additional IP addresses (host)

For our dedicated root servers (with the exception of SX131 / 291 models), you can order up to 6 additional single IPs. The network configuration is similar in both cases.

In order to use the additional addresses on the server (no virtualization), you need the package and service program. Configuration with alias interfaces (such as, etc.) are outdated; you should no longer use them. To add an address, please run:

The command shows the IP addresses which are currently active. The server uses the entire subnet, so it is also useful here to add the addresses with the prefix / 32, which means the subnet mask is.

Configuration

In, insert the following two lines in the appropriate interface (e.g.):

For and, expect just one line of shell code and this can be repeated for several addresses. The disadvantage is that you need to list both the interface name and address twice. If you are using many IPs, the configuration file becomes confusing and prone to errors. And if you change the data, you need to adjust all the entries.

Alternative configuration via addresses script

ATTENTIONThe following instructions involve the installation of software by a third party (www.wertarbyte.de). This is not supported by Hetzner. In the event of errors or problems, please contact the developer.

The script is in the package, which is not a part of the official Debian distribution. If you add the following line for APT configuration, you just need to use the command to install the script correctly:

You can make the complete installation routine shorter using the following commands:

If you do not wish to install the script using the package system, you can also download it manually: http://wertarbyte.de/debian/ifupdown/addresses. It is filed in the directory and also linked with:

It is recommended to install the script via the packet system because the current version of the script is always available.

The script extends the syntax of the configuration file by adding a new command. This lets you specify additional binding IP addresses (with the netmask in / -notation):

If you add this line to configure the "eth0" interface, addresses are added upon activating the interface and removed upon deactivation.

It is also possible to use several lines to bundle addresses into categories and to make the configuration more transparent:

The script captures various commands that start with the key word and a label of your choice. You shouldn't use labels twice. Otherwise you will get a syntax error for ifupdown, and the configuration of the interface will be interrupted. This can result in the server not being reachable.

The IP addresses which you have added via are not visible in the output of; you need the command to show these. However, the addresses script can also set up alias devices:

The script creates consecutively numbered eth0: X devices using this configuration, which are also visible in.

Instead of simply numbering the devices, it is also possible to use the labels from the configuration:

The addresses are subsequently labeled or in the output of and are also shown in.

Additional IP addresses (virtualization)

With virtualization, the additional IP addresses are used via the guest system. To make these reachable via the Internet, you need to adjust the configuration in the host system accordingly in order to forward the packets. There are two ways of doing this for additional single IPs: the routed and bridged methods.

Routed (brouter)

In this type of configuration, the packets are routed. For this method, you need to set up an additional bridge with almost the same configuration (without gateway) as eth0.

Host:

You also need to create a corresponding host route for each additional IP address. For IPv4, the eth0 configuration remains unchanged. For IPv6, you need to reduce the prefix from / 64 to / 128.

Guest:

Bridged

With a bridged configuration, packets are sent directly. The guest system behaves as if it is independent. This makes the MAC addresses of the guest system visible from the outside, so you need to request a virtual MAC address for each single IP address. (Make a support request on Robot). Then assign the virutal MAC address to the guest network card. The bridge gets the same network configuration as eth0.

The configuration of is omitted without replacement.