Hetzner Cloud Networks Configuration

Last change on 2024-06-18 • 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)

  • Ubuntu 24.04
curl https://packages.hetzner.com/hcloud/deb/hc-utils_0.0.6-1_all.deb -o /tmp/hc-utils_0.0.6-1_all.deb -s
apt install /tmp/hc-utils_0.0.6-1_all.deb
  • Debian, Ubuntu 20.04 or older
curl https://packages.hetzner.com/hcloud/deb/hc-utils_0.0.5-1_all.deb -o /tmp/hc-utils_0.0.5-1_all.deb -s
apt install /tmp/hc-utils_0.0.5-1_all.deb

On RHEL based distributions (Alma, CentOS, Fedora, Rocky)

  • Alma/CentOS/Rocky 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
  • Alma/CentOS/Rocky 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

    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 (Alma, CentOS, Fedora, Rocky)

    dnf remove hc-utils

Manual configuration via DHCP

Debian / Ubuntu

Network interface names:

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

Debian (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*1 and CCX*1 (Intel)

      auto ens10
      iface ens10 inet dhcp
    • CX*2 (Intel), CAX (ARM), CPX, CCX*2, and CCX*3 (AMD)

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

    sudo service networking restart

Ubuntu (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*1 and CCX*1 (Intel)

      network:
        version: 2
        renderer: networkd
        ethernets:
          ens10:
            dhcp4: true
    • CX*2 (Intel), CAX (ARM), CPX, CCX*2, CCX*3 (AMD)

      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

On RHEL based distributions (Alma, CentOS, Fedora, Rocky)

CentOS 7

Network interface names:

Network 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-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

Alma/CentOS/Rocky 8 or higher, Fedora

Network interface names:

Network CX*1, CCX*1 CX*2, CAX, CPX, CCX*2, CCX*3
First attached network ens10 enp7s0
Additional interfaces (second) ens11 enp8s0
Additional interfaces (third) ens12 enp9s0
  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

Network interface names:

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

Debian (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 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

Ubuntu (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*1 and CCX*1 (Intel)

      network:
        version: 2
        renderer: networkd
        ethernets:
          ens10:
            dhcp4: true
            addresses:
              - your.ali.as.IP/32
    • CX*2 (Intel), CAX (ARM), CPX, CCX*2, CCX*3 (AMD)

      network:
        version: 2
        renderer: networkd
        ethernets:
          enp7s0:
            dhcp4: true
            addresses:
              - your.ali.as.IP/32
  3. Now you should restart your network. Caution: This will reset your network connection.

    sudo netplan generate
    sudo netplan apply

On RHEL based distributions (Alma, CentOS, Fedora, Rocky)

CentOS 7

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

Alma/CentOS/Rocky 8 or higher, Fedora

  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 CX*1, CCX*1 CX*2, CAX, CPX, CCX*2, CCX*3
First attached network ens10 enp7s0
Additional interfaces (second) ens11 enp8s0
Additional interfaces (third) ens12 enp9s0

Debian (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 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

Ubuntu (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*1 and CCX*1 (Intel)

      network:
        version: 2
        renderer: networkd
        ethernets:
          ens10:
            addresses:
              - private.IP/32
            routes:
              - to: net.work.ip.range
                via: gateway.of.the.network
                on-link: true
    • CX*2 (Intel), CAX (ARM), CPX, CCX*2, CCX*3 (AMD)

      network:
        version: 2
        renderer: networkd
        ethernets:
          enp7s0:
            addresses:
              - private.IP/32
            routes:
              - to: net.work.ip.range
                via: gateway.of.the.network
                on-link: true
  3. Now you should restart your network. Caution: This will reset your network connection.

    sudo netplan generate
    sudo netplan apply

On RHEL based distributions (Alma, CentOS, Fedora, Rocky)

CentOS 7

Network interface names:

Network Name
First attached network eth0
Additional interfaces (second) eth1
Additional interfaces (third) 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

Alma/CentOS/Rocky 8 or higher, Fedora

Network interface names:

Network CX*1, CCX*1 CX*2, CAX, CPX, CCX*2, CCX*3
First attached network ens10 enp7s0
Additional interfaces (second) ens11 enp8s0
Additional interfaces (third) ens12 enp9s0
  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