Hetzner - DokuWiki

Cloud floating IP persistent/en
K (CentOS/Fedora)
(Cloud floating IP persistent)
Zeile 3: Zeile 3:
 
= Cloud floating IP persistent =
 
= Cloud floating IP persistent =
  
If you are using more than one&nbsp; floating IP, then the number on the interface (eth0:'''1'''<span style="font-size: 12px;">) will be increased (example eth0:</span>'''2'''<span style="font-size: 12px;">)</span>
+
If you are using more than one floating IP, then the number on the interface (eth0:'''1''') will be increased (example eth0:'''2''')
  
== <span class="mw-headline" id="Debian.2FUbuntu"><span class="mw-headline" id="Debian.2FUbuntu">Debian/Ubuntu</span></span> ==
+
On '''Debian based''' distributions (Ubuntu, Debian):
 +
 
 +
* SSH into the server
 +
* Create the configuration file and open an editor
 +
 
 +
touch /etc/network/interfaces.d/60-my-floating-ip.cfg
 +
nano /etc/network/interfaces.d/60-my-floating-ip.cfg
 +
 
 +
* Paste the following configuration into the editor and replace <span style="color: #ff0000;">your.float.ing.ip</span> with your floating ip
 +
 
 +
IPv4:
 +
auto eth0:1
 +
iface eth0:1 inet static
 +
    address <span style="color: #ff0000;">your.float.ing.ip</span>
 +
    netmask 32
  
edit of /etc/network/interfaces.d/99-floating.cfg IPv4:
 
<pre>auto eth0:1
 
iface eth0:1 inet static
 
    address <your floating IP>
 
    netmask 255.255.255.255
 
</pre>
 
 
IPv6:
 
IPv6:
<pre>auto eth0:1
+
auto eth0:1
iface eth0:1 inet6 static
+
iface eth0:1 inet6 static
    address <one IPv6 address of the subnet, e.g. 2a01:4f9:0:2a1::2>
+
    address <span style="color: #ff0000;">one IPv6 address of the subnet, e.g. 2a01:4f9:0:2a1::2</span>
    netmask 64
+
    netmask 64
</pre>
+
After the reboot of the cloud server, the floating IP should be available.
+
  
== <span class="mw-headline" id="CentOS.2FFedora"><span class="mw-headline" id="CentOS.2FFedora">CentOS/Fedora</span></span> ==
 
  
edit of /etc/sysconfig/network-scripts/ifcfg-eth0:1 IPv4:
+
* Now you should restart your network. '''Caution: This will reset your network connection'''
<pre>BOOTPROTO=none
+
 
DEVICE=eth0:1
+
sudo service networking restart
ONBOOT=yes
+
 
IPADDR=<your floating IP>
+
On '''RHEL based''' distributions (Fedora, CentOS):
NETMASK=255.255.255.255
+
 
</pre>
+
* SSH into the server
 +
 
 +
* Create the configuration file and open an editor
 +
 
 +
touch /etc/sysconfig/network-scripts/ifcfg-eth0:1
 +
vi /etc/sysconfig/network-scripts/ifcfg-eth0:1
 +
 
 +
* Paste the following configuration into the editor and replace <span style="color: #ff0000;">your.float.ing.ip</span> with your floating ip
 +
 
 +
IPv4:
 +
 
 +
BOOTPROTO=static
 +
DEVICE=eth0:1
 +
IPADDR=<span style="color: #ff0000;">your.float.ing.ip</span>
 +
PREFIX=32
 +
TYPE=Ethernet
 +
USERCTL=no
 +
ONBOOT=yes
 +
 
 
IPv6:
 
IPv6:
<pre>BOOTPROTO=none
+
 
DEVICE=eth0:1
+
BOOTPROTO=none
ONBOOT=yes
+
DEVICE=eth0:1
IPV6ADDR=<one IPv6 address of the subnet, e.g. 2a01:4f9:0:2a1::2>/64
+
ONBOOT=yes
IPV6INIT=yes
+
IPV6ADDR=<span style="color: #ff0000;">one IPv6 address of the subnet, e.g. 2a01:4f9:0:2a1::2</span>/64
</pre>
+
IPV6INIT=yes
 +
 
 +
* Now you should restart your network. '''Caution: This will reset your network connection'''
 +
 
 +
systemctl restart network
  
 
[[Kategorie:Cloud]]
 
[[Kategorie:Cloud]]
 
[[Kategorie:Hetzner Cloud]]
 
[[Kategorie:Hetzner Cloud]]

Version vom 9. Juli 2018, 12:01 Uhr

Cloud floating IP persistent

If you are using more than one floating IP, then the number on the interface (eth0:1) will be increased (example eth0:2)

On Debian based distributions (Ubuntu, Debian):

  • SSH into the server
  • Create the configuration file and open an editor
touch /etc/network/interfaces.d/60-my-floating-ip.cfg
nano /etc/network/interfaces.d/60-my-floating-ip.cfg
  • Paste the following configuration into the editor and replace your.float.ing.ip with your floating ip

IPv4:

auto eth0:1
iface eth0:1 inet static
    address your.float.ing.ip
    netmask 32

IPv6:

auto eth0:1
iface eth0:1 inet6 static
    address one IPv6 address of the subnet, e.g. 2a01:4f9:0:2a1::2
    netmask 64


  • Now you should restart your network. Caution: This will reset your network connection
sudo service networking restart

On RHEL based distributions (Fedora, CentOS):

  • SSH into the server
  • Create the configuration file and open an editor
touch /etc/sysconfig/network-scripts/ifcfg-eth0:1
vi /etc/sysconfig/network-scripts/ifcfg-eth0:1
  • Paste the following configuration into the editor and replace your.float.ing.ip with your floating ip

IPv4:

BOOTPROTO=static
DEVICE=eth0:1
IPADDR=your.float.ing.ip
PREFIX=32
TYPE=Ethernet
USERCTL=no
ONBOOT=yes

IPv6:

BOOTPROTO=none
DEVICE=eth0:1
ONBOOT=yes
IPV6ADDR=one IPv6 address of the subnet, e.g. 2a01:4f9:0:2a1::2/64
IPV6INIT=yes
  • Now you should restart your network. Caution: This will reset your network connection
systemctl restart network


© 2019. Hetzner Online GmbH. Alle Rechte vorbehalten.