Hetzner - DokuWiki

Cloud Networks Configuration/en

Inhaltsverzeichnis

Hetzner Cloud Networks Configuration

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.2-1_all.deb -o /tmp/hc-utils_0.0.2-1_all.deb -s
apt install -f /tmp/hc-utils_0.0.2-1_all.deb

On RHEL based distributions:

CentOS 7

curl https://packages.hetzner.com/hcloud/rpm/hc-utils-0.0.2-1.el7.noarch.rpm -o /tmp/hc-utils-0.0.2-1.el7.noarch.rpm -s
yum install /tmp/hc-utils-0.0.2-1.el7.noarch.rpm

CentOS 8

curl https://packages.hetzner.com/hcloud/rpm/hc-utils-0.0.2-1.el8.noarch.rpm -o /tmp/hc-utils-0.0.2-1.el7.noarch.rpm -s
yum install /tmp/hc-utils-0.0.2-1.el8.noarch.rpm

Fedora 30

curl https://packages.hetzner.com/hcloud/rpm/hc-utils-0.0.2-1.fc30.noarch.rpm -o /tmp/hc-utils-0.0.2-1.fc30.noarch.rpm -s
dnf install /tmp/hc-utils-0.0.2-1.fc30.noarch.rpm

Fedora 31

curl https://packages.hetzner.com/hcloud/rpm/hc-utils-0.0.2-1.fc31.noarch.rpm -o /tmp/hc-utils-0.0.2-1.fc31.noarch.rpm -s
dnf install /tmp/hc-utils-0.0.2-1.fc31.noarch.rpm

Uninstall auto-configuration package

On Debian based distributions (Ubuntu, Debian):

apt remove hc-utils

On RHEL based distributions (Fedora, CentOS):

yum remove hc-utils

Manual configuration via DHCP

On Debian based distributions (Ubuntu, Debian):The interface for the network will be named `ens10` for the first attached network, `ens11` for the second and `ens12` for the third.1. Access the server via SSH2. Create the configuration file and open an editor

touch /etc/network/interfaces.d/61-my-private-network.cfg
nano /etc/network/interfaces.d/61-my-private-network.cfg

3. Paste the following configuration into the editor.

auto ens10:0
iface ens10:0 inet dhcp

4. Now you should restart your network. *Caution: This will reset your network connection*

sudo service networking restart

On RHEL based distributions (Fedora, CentOS): The interfaces will be named `eth1`,`eth2` and `eth3`. 1. Access the server via SSH 2. Create the configuration file and open an editor

touch /etc/sysconfig/network-scripts/ifcfg-eth1
vi /etc/sysconfig/network-scripts/ifcfg-eth1

3. Paste the following configuration into the editor

DEVICE=eth1
BOOTPROTO=dhcp
ONBOOT=yes

4. Now you should restart your network. *Caution: This will reset your network connection*

systemctl restart network

Manual configuration of alias IPs

On Debian based distributions (Ubuntu, Debian):1. Access the server via SSH2. Create the configuration file and open an editor

touch /etc/network/interfaces.d/61-my-private-network.cfg
nano /etc/network/interfaces.d/61-my-private-network.cfg

3. 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

4. Now you should restart your network. *Caution: This will reset your network connection*

sudo service networking restart

On RHEL based distributions: The interfaces will be named `eth1` and up to `eth3`. 1. Access the server via SSH 2. Create the configuration file and open an editor

touch /etc/sysconfig/network-scripts/ifcfg-eth1:0
vi /etc/sysconfig/network-scripts/ifcfg-eth1:0

3. 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

4. Now you should restart your network. *Caution: This will reset your network connection*

systemctl restart network


Manual static configuration

On Debian based distributions (Ubuntu, Debian):

The interface for the network will be named `ens10` for the first attached network, `ens11` for the second and `ens12` for the third.

1. Access the server via SSH

2. Create the configuration file and open an editor

touch /etc/network/interfaces.d/61-my-private-network.cfg
nano /etc/network/interfaces.d/61-my-private-network.cfg

3. Paste the following configuration into the editor and replace the highlighted values 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/8 via gateway.of.the.network dev ens10

4. Now you should restart your network. *Caution: This will reset your network connection*

sudo service networking restart

On RHEL based distributions (Fedora, CentOS):

The interfaces will be named `ens10`,`ens11` and `ens12`. CentOS is still using eth0, eth1 and eth2.

1. Access the server via SSH

2. Create the configuration file and open an editor

touch /etc/sysconfig/network-scripts/ifcfg-ens10
vi /etc/sysconfig/network-scripts/ifcfg-ens10

3. 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

4. Create the route configuration file and open an editor

touch /etc/sysconfig/network-scripts/route-ens10
vi /etc/sysconfig/network-scripts/route-ens10

5. Paste the following configuration into the editor and replace the highlighted values with the values of your Network.

gateway.of.the.network/32 via 0.0.0.0 dev ens10 scope link
net.work.ip.range/8 via gateway.of.the.network dev ens10

4. Now you should restart your network. *Caution: This will reset your network connection*

systemctl restart network

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

You need the red bold number.

4. Add the static routes to interface

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 static configuration

netsh interface ip show config

Output should 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:  213.133.99.99
                                         213.133.100.100
                                         213.133.98.98
   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


© 2019. Hetzner Online GmbH. Alle Rechte vorbehalten.