Hetzner - DokuWiki
Cloud Networks Configuration/en
(→Hetzner Cloud Networks Configuration) |
|||
Zeile 121: | Zeile 121: | ||
USERCTL=no | USERCTL=no | ||
ONBOOT=yes | ONBOOT=yes | ||
+ | |||
+ | 4. Now you should restart your network. *Caution: This will reset your network connection* | ||
+ | |||
+ | systemctl restart network | ||
+ | |||
+ | |||
+ | == <span id="networks_configuration_manual"></span>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 <span style="color: #ff0000;">highlighted</span> values with the values of your Network. | ||
+ | |||
+ | auto ens10 | ||
+ | iface ens10 inet static | ||
+ | address <span style="color: #ff0000;">private.address.ofThe.CloudServer</span> | ||
+ | netmask 255.255.255.255 | ||
+ | pointopoint <span style="color: #ff0000;">gateway.of.the.network</span> | ||
+ | post-up ip route add <span style="color: #ff0000;">net.work.ip.range/8</span> via <span style="color: #ff0000;">gateway.of.the.network</span> 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`. | ||
+ | |||
+ | 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 <span style="color: #ff0000;">private.address.ofThe.CloudServer</span> with the private network IP of your server. | ||
+ | |||
+ | BOOTPROTO=static | ||
+ | DEVICE=ens10 | ||
+ | IPADDR=<span style="color: #ff0000;">private.address.ofThe.CloudServer</span> | ||
+ | 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 <span style="color: #ff0000;">highlighted</span> values with the values of your Network. | ||
+ | |||
+ | <span style="color: #ff0000;">gateway.of.the.network</span>/32 via 0.0.0.0 dev ens10 scope link | ||
+ | <span style="color: #ff0000;">net.work.ip.range/8</span> via <span style="color: #ff0000;">gateway.of.the.network</span> dev ens10 | ||
4. Now you should restart your network. *Caution: This will reset your network connection* | 4. Now you should restart your network. *Caution: This will reset your network connection* | ||
systemctl restart network | systemctl restart network |
Version vom 8. August 2019, 12:35 Uhr
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.1-1_all.deb -o /tmp/hc-utils_0.0.1-1_all.deb -s apt install -f /tmp/hc-utils_0.0.1-1_all.deb
On RHEL based distributions:
CentOS 7
curl https://packages.hetzner.com/hcloud/rpm/hc-utils-0.0.1-1.el7.noarch.rpm -o /tmp/hc-utils-0.0.1-1.el7.noarch.rpm -s yum install /tmp/hc-utils-0.0.1-1.el7.noarch.rpm
Fedora 29
curl https://packages.hetzner.com/hcloud/rpm/hc-utils-0.0.1-1.fc29.noarch.rpm -o /tmp/hc-utils-0.0.1-1.fc29.noarch.rpm -s yum install /tmp/hc-utils-0.0.1-1.fc29.noarch.rpm
Fedora 30
curl https://packages.hetzner.com/hcloud/rpm/hc-utils-0.0.1-1.fc30.noarch.rpm -o /tmp/hc-utils-0.0.1-1.fc30.noarch.rpm -s yum install /tmp/hc-utils-0.0.1-1.fc30.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 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
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 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 `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`,`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: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 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`.
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
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