Hetzner - DokuWiki
Cloud Networks Configuration/en
(→Hetzner Cloud Networks Configuration) |
|||
(5 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
{{Languages|Cloud Networks Configuration}} | {{Languages|Cloud Networks Configuration}} | ||
− | = Hetzner Cloud Networks Configuration = | + | =Hetzner Cloud Networks Configuration= |
− | + | ==<span id="networks_configuration_install_package"></span>Installation of the auto-configuration package== | |
− | == <span id="networks_configuration_install_package"></span>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/ |
− | 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): | On Debian based distributions (Ubuntu, Debian): | ||
− | curl https://packages.hetzner.com/hcloud/deb/hc-utils_0.0. | + | 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. | + | apt install -f /tmp/hc-utils_0.0.2-1_all.deb |
On RHEL based distributions: | On RHEL based distributions: | ||
Zeile 16: | Zeile 14: | ||
CentOS 7 | CentOS 7 | ||
− | curl https://packages.hetzner.com/hcloud/rpm/hc-utils-0.0. | + | 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. | + | 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. | + | 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. | + | yum install /tmp/hc-utils-0.0.2-1.el8.noarch.rpm |
Fedora 30 | Fedora 30 | ||
− | curl https://packages.hetzner.com/hcloud/rpm/hc-utils-0.0. | + | 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 | |
− | == <span id="networks_configuration_uninstall_package"></span>Uninstall auto-configuration package== | + | 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 | ||
+ | |||
+ | ==<span id="networks_configuration_uninstall_package"></span>Uninstall auto-configuration package== | ||
On Debian based distributions (Ubuntu, Debian): | On Debian based distributions (Ubuntu, Debian): | ||
Zeile 38: | Zeile 41: | ||
yum remove hc-utils | yum remove hc-utils | ||
− | == <span id="networks_configuration_dhcp_configuration"></span>Manual configuration via DHCP == | + | ==<span id="networks_configuration_dhcp_configuration"></span>Manual configuration via DHCP== |
− | On Debian based distributions (Ubuntu, Debian): | + | 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 |
− | + | ||
− | 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 | + | |
− | + | ||
− | + | ||
touch /etc/network/interfaces.d/61-my-private-network.cfg | touch /etc/network/interfaces.d/61-my-private-network.cfg | ||
nano /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 | + | 3. Paste the following configuration into the editor. |
auto ens10:0 | auto ens10:0 | ||
Zeile 60: | Zeile 57: | ||
On RHEL based distributions (Fedora, CentOS): | On RHEL based distributions (Fedora, CentOS): | ||
− | |||
The interfaces will be named `eth1`,`eth2` and `eth3`. | The interfaces will be named `eth1`,`eth2` and `eth3`. | ||
− | |||
1. Access the server via SSH | 1. Access the server via SSH | ||
− | |||
2. Create the configuration file and open an editor | 2. Create the configuration file and open an editor | ||
Zeile 80: | Zeile 74: | ||
systemctl restart network | systemctl restart network | ||
− | == <span id="networks_configuration_alias_ips"></span>Manual configuration of alias IPs == | + | ==<span id="networks_configuration_alias_ips"></span>Manual configuration of alias IPs== |
− | On Debian based distributions (Ubuntu, Debian): | + | On Debian based distributions (Ubuntu, Debian):1. Access the server via SSH2. Create the configuration file and open an editor |
− | + | ||
− | 1. Access the server via | + | |
− | + | ||
− | + | ||
touch /etc/network/interfaces.d/61-my-private-network.cfg | touch /etc/network/interfaces.d/61-my-private-network.cfg | ||
nano /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 | + | 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 | auto ens10:1 | ||
Zeile 102: | Zeile 92: | ||
On RHEL based distributions: | On RHEL based distributions: | ||
− | + | The interfaces will be named `eth1` and up to `eth3`. | |
− | The interfaces will be named `eth1 | + | |
− | + | ||
1. Access the server via SSH | 1. Access the server via SSH | ||
− | |||
2. Create the configuration file and open an editor | 2. Create the configuration file and open an editor | ||
Zeile 112: | Zeile 99: | ||
vi /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 | + | 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 | BOOTPROTO=static | ||
Zeile 125: | Zeile 112: | ||
systemctl restart network | 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 | ||
+ | mtu 1450 | ||
+ | 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`. '''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 <span style="color: #ff0000;">private.address.ofThe.CloudServer</span> with the private network IP of your server. | ||
+ | |||
+ | BOOTPROTO=static | ||
+ | DEVICE=ens10 | ||
+ | MTU=1450 | ||
+ | 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* | ||
+ | |||
+ | 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 | ||
+ | <span style="color: #ff0000;"><strong>5</strong>...xx xx xx xx xx xx ......Red Hat VirtIO Ethernet Adapter #2</span> | ||
+ | 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 <span style="color: #ff0000;">gateway.of.the.network</span> 0.0.0.0 if <strong><span style="color: #ff0000;">5</span></strong> | ||
+ | route add -p <span style="color: #ff0000;">net.work.ip.range</span> mask <span style="color: #ff0000;">mask.of.network.range</span> <span style="color: #ff0000;">gateway.of.the.network</span> if <strong><span style="color: #ff0000;">5</span></strong> | ||
+ | |||
+ | 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 <span style="color: #ff0000;"><strong>"Ethernet 2"</strong></span> | ||
+ | DHCP enabled: Yes | ||
+ | IP Address: <span style="color: #ff0000;">private.address.ofThe.CloudServer</span> | ||
+ | Subnet Prefix: <span style="color: #ff0000;">private.address.ofThe.CloudServer</span>/32 (mask 255.255.255.255) | ||
+ | Default Gateway: <span style="color: #ff0000;">gateway.of.the.network</span> | ||
+ | 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=<span style="color: #ff0000;"><strong>"Ethernet 2"</strong></span> static <span style="color: #ff0000;">private.address.ofThe.CloudServer</span> 255.255.255.255 <span style="color: #ff0000;">gateway.of.the.network</span> 1 |
Version vom 12. November 2019, 15:09 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.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