Hetzner Cloud Networks Configuration

Last change on 2023-08-25 • Created on 2020-07-02 • ID: CL-96759

Installation of the auto-configuration package

Download the latest version of hc-utils for your OS and your architecture on: https://packages.hetzner.com/hcloud/

On Debian based distributions (Ubuntu, Debian)

curl https://packages.hetzner.com/hcloud/deb/hc-utils_0.0.4-1_all.deb -o /tmp/hc-utils_0.0.4-1_all.deb -s
apt install /tmp/hc-utils_0.0.4-1_all.deb

On RHEL based distributions

  • CentOS 7

    curl https://packages.hetzner.com/hcloud/rpm/hc-utils-0.0.3-1.el7.noarch.rpm -o /tmp/hc-utils-0.0.3-1.el7.noarch.rpm -s
    yum install /tmp/hc-utils-0.0.3-1.el7.noarch.rpm
  • CentOS 8 / 9

    curl https://packages.hetzner.com/hcloud/rpm/hc-utils-0.0.4-1.el8.noarch.rpm -o /tmp/hc-utils-0.0.4-1.el8.noarch.rpm -s
    yum install /tmp/hc-utils-0.0.4-1.el8.noarch.rpm
  • Fedora 36

    dnf install https://packages.hetzner.com/hcloud/rpm/hc-utils-0.0.4-1.fc36.noarch.rpm
  • Fedora 37 / 38

    dnf install https://packages.hetzner.com/hcloud/rpm/hc-utils-0.0.4-1.fc37.noarch.rpm

Uninstall auto-configuration package

  • On Debian based distributions (Ubuntu, Debian):

    apt remove hc-utils
  • On RHEL based distributions (Fedora, CentOS):

    dnf remove hc-utils

Manual configuration via DHCP

Debian / Ubuntu

Network interface names:

Network CX, CCX*1 CPX, CAX, CCX*2, CCX*3
First attached network ens10 enp7s0
Additional interfaces (second) ens11 enp8s0
Additional interfaces (third) ens12 enp9s0

ifup

  1. Open the configuration file with an editor:

    nano /etc/network/interfaces.d/61-my-private-network.cfg
  2. Paste the following configuration into the editor:

    • CX and CCX*1 (Intel CPU)

      auto ens10
      iface ens10 inet dhcp
    • CPX, CCX*2, and CCX*3 (AMD CPU)

      auto enp7s0
      iface enp7s0 inet dhcp
    • CAX (ARM CPU)

      auto enp7s0
      iface enp7s0 inet dhcp
  3. Now you should restart your network. Caution: This will reset your network connection.

    sudo service networking restart

netplan

  1. Open the configuration file with an editor:

    vi /etc/netplan/60-my-private-network.yaml
  2. Paste the following configuration into the editor:

    • CX and CCX*1 (Intel CPU)

      network:
          version: 2
          renderer: networkd
          ethernets:
              ens10:
                  dhcp4: true
    • CPX, CCX*2, CCX*3 (AMD CPU)

      network:
          version: 2
          renderer: networkd
          ethernets:
              enp7s0:
                  dhcp4: true
    • CAX (ARM CPU)

      network:
          version: 2
          renderer: networkd
          ethernets:
              enp7s0:
                  dhcp4: true
  3. Now you should restart your network. Caution: This will reset your network connection.

    sudo netplan generate
    sudo netplan apply

CentOS / Fedora (up to 37)

Network interface names:

Network Fedora
CX, CCX*1
Fedora
CPX, CCX*2, CCX*3
CentOS
CX, CPX, CCX*1, CCX*2, CCX*3
First attached network ens10 enp7s0 eth1
Additional interfaces (second) ens11 enp8s0 eth2
Additional interfaces (third) ens12 enp9s0 eth3
  1. Open the configuration file with an editor:

    vi /etc/sysconfig/network-scripts/ifcfg-ens10
  2. Paste the following configuration into the editor:

    DEVICE=ens10
    BOOTPROTO=dhcp
    ONBOOT=yes
  3. Now you should restart your network. Caution: This will reset your network connection.

    systemctl restart network

Fedora 38

  1. Open the configuration file with an editor:

    vi /etc/NetworkManager/system-connections/enp7s0.nmconnection:
  2. Paste the following configuration into the editor:

    [connection]
    id=enp7s0
    uuid=<insert a uuid!!>
    type=ethernet
    
    [ethernet]
    mac-address=<insert the HWADDR of your private networks interface!!>
    
    [ipv4]
    method=auto
    may-fail=false
  3. Now you should restart your network. Caution: This will reset your network connection.

    systemctl restart NetworkManager

Manual configuration of alias IPs

Debian / Ubuntu

  1. Open the configuration file with an editor:

    nano /etc/network/interfaces.d/61-my-private-network.cfg
  2. Paste the following configuration into the editor and replace your.ali.as.IP with one of the alias IPs. Keep in mind to increase the identifier by one when using more alias IPs.

    auto ens10:1
    iface ens10:1 inet static
       address your.ali.as.IP
       netmask 32
  3. Now you should restart your network. Caution: This will reset your network connection.

    sudo service networking restart

CentOS / Fedora (up to 37):

Network interface names:

Network Interface Name
First attached network eth1
Additional interfaces (second) eth2
Additional interfaces (third) eth3
  1. Open the configuration file with an editor:

    vi /etc/sysconfig/network-scripts/ifcfg-eth1:0
  2. Paste the following configuration into the editor and replace your.ali.as.IP with one of the alias IPs. Keep in mind to increase the identifier by one when using more alias IPs.

    BOOTPROTO=static
    DEVICE=eth1:0
    IPADDR=your.ali.as.IP
    PREFIX=32
    TYPE=Ethernet
    USERCTL=no
    ONBOOT=yes
  3. Now you should restart your network. Caution: This will reset your network connection.

    systemctl restart network

Fedora 38

  1. Open the configuration file with an editor:

    vi /etc/NetworkManager/system-connections/enp7s0.nmconnection
  2. Paste the following configuration into the editor and change the uuid, mac-address and IP.

    [connection]
    id=enp7s0
    uuid=<keep the UUID as is!!>
    type=ethernet
    
    [ethernet]
    mac-address=<keep the HWADDR as is!!>
    
    [ipv4]
    method=auto
    address2=<your alias ip>/32
    may-fail=false
  3. Now you should restart your network. Caution: This will reset your network connection.

    sudo service NetworkManager restart

Manual static configuration

On Debian based distributions (Ubuntu, Debian):

Network interface names:

Network Ubuntu / Debian
First attached network ens10
Additional interfaces (second) ens11
Additional interfaces (third) ens12
  1. Open the configuration file with an editor:

    nano /etc/network/interfaces.d/61-my-private-network.cfg
  2. Paste the following configuration into the editor and replace private.address.ofThe.CloudServer, gateway.of.the.network and net.work.ip.range with the values of your network.

    auto ens10
    iface ens10 inet static
       address private.address.ofThe.CloudServer
       netmask 255.255.255.255
       mtu 1450
       pointopoint gateway.of.the.network
       post-up ip route add net.work.ip.range via gateway.of.the.network dev ens10
  3. Now you should restart your network. Caution: This will reset your network connection.

    sudo service networking restart

On RHEL based distributions (Fedora (up to 37), CentOS):

Network interface names:

Network Fedora CentOS
First attached network ens10 eth0
Additional interfaces (second) ens11 eth1
Additional interfaces (third) ens12 eth2
  1. Open the configuration file with an editor:

    vi /etc/sysconfig/network-scripts/ifcfg-ens10
  2. Paste the following configuration into the editor and replace the private.address.ofThe.CloudServer with the private network IP of your server.

    BOOTPROTO=static
    DEVICE=ens10
    MTU=1450
    IPADDR=private.address.ofThe.CloudServer
    PREFIX=32
    TYPE=Ethernet
    USERCTL=no
    ONBOOT=yes
  3. Open the route configuration file with an editor:

    vi /etc/sysconfig/network-scripts/route-ens10
  4. Paste the following configuration into the editor and replace private.address.ofThe.CloudServer, gateway.of.the.network and net.work.ip.range with the values of your network.

    gateway.of.the.network/32 via 0.0.0.0 dev ens10 scope link
    net.work.ip.range via gateway.of.the.network dev ens10
  5. Now you should restart your network. Caution: This will reset your network connection.

    systemctl restart network

Fedora 38

  1. Open the configuration file with an editor:

    vi /etc/NetworkManager/system-connections/enp7s0.nmconnection
  2. Paste the following configuration into the editor and change it to your needs.

    [connection]
    id=enp7s0
    uuid=<keep the UUID as is!!>
    type=ethernet
    
    [ethernet]
    mac-address=<keep the HWADDR as is!!>
    
    [ipv4]
    address1=<your Private IPv4 address>/32,<your private networks gateway>
    may-fail=false
    method=manual
  3. Now you should restart your network. Caution: This will reset your network connection.

    systemctl restart NetworkManager

Manual Configuration for Windows based systems

  1. Access the server via RDP or HTML5 console.

  2. Open an elevated CMD.

  3. Print the interface list and get the interface ID of interface Red Hat VirtIO Ethernet Adapter #2.

    route print ?

    It should look like this:

    Interface List
    3...xx xx xx xx xx xx ......Red Hat VirtIO Ethernet Adapter
    5...xx xx xx xx xx xx ......Red Hat VirtIO Ethernet Adapter #2
    1...........................Software Loopback Interface 1
    2...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
    4...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface
    7...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
  4. Add the static routes to interface by replacing mask.of.network.range, gateway.of.the.network and net.work.ip.range with the values of your network.

    route add -p gateway.of.the.network 0.0.0.0 if 5
    route add -p net.work.ip.range mask mask.of.network.range gateway.of.the.network if 5
  5. Check the interface name for the static configuration:

    netsh interface ip show config

    The output should look something like this:

    Configuration for interface "Ethernet"
       DHCP enabled:                         Yes
       IP Address:                           xxx.xxx.xxx.xxx
       Subnet Prefix:                        xxx.xxx.xxx.xxx/32 (mask 255.255.255.255)
       Default Gateway:                      172.31.1.1
       Gateway Metric:                       0
       InterfaceMetric:                      5
       DNS servers configured through DHCP:  185.12.64.1
                                             185.12.64.2
       Register with which suffix:           Primary only
       WINS servers configured through DHCP: None
    Configuration for interface "Ethernet 2"
       DHCP enabled:                         Yes
       IP Address:                           private.address.ofThe.CloudServer
       Subnet Prefix:                        private.address.ofThe.CloudServer/32 (mask 255.255.255.255)
       Default Gateway:                      gateway.of.the.network
       Gateway Metric:                       0
       InterfaceMetric:                      5
       DNS servers configured through DHCP:  None
       Register with which suffix:           Primary only
       WINS servers configured through DHCP: None
    Configuration for interface "Loopback Pseudo-Interface 1"
       DHCP enabled:                         No
       IP Address:                           127.0.0.1
       Subnet Prefix:                        127.0.0.0/8 (mask 255.0.0.0)
       InterfaceMetric:                      75
       Statically Configured DNS Servers:    None
       Register with which suffix:           None
       Statically Configured WINS Servers:   None
  6. Set the IP address to interface:

    netsh interface ipv4 set address name="Ethernet 2" static private.address.ofThe.CloudServer 255.255.255.255 gateway.of.the.network 1
Table of Contents