ipv4-address-assigned

Example:

# Add a floating IP to a Hetzner cloud VM
- ipv4-address-assigned:
    iface: eth0:1
    ip: 195.201.251.122

Description

Add an IP address to an interface.

This is often relevant for cloud services that offer so-called 'floating' IP addresses. Those are a useful, because you can point a dns record to them, and then easily switch the underlaying virtual machine. Otherwise you'd have to change the dns record, which would mean you'd have to wait for that change to propagate through all the dns layers. That usually takes a few hours, or even a day in some cases.

This frecklet does not check whether the interface was already added at a different location than the value of iface_file_name. Also, this only adds a very basic interface, in the form of:

auto <interface>
iface <interface> inet static
  address <ip>
  netmask 32

Currently this task also restarts the 'networking' service, independent of whether the interface was changed or not.

Variables

Name Type Default Description

ip

string --

The ip to assign. Required

iface

string eth0:1

The name of the network interface.

iface_file_name

string 60-floating-ip.cfg

The name of the interface file under /etc/network/interfaces.d.

Examples

Example 1

Add a floating IP to a Hetzner cloud VM

Code
- ipv4-address-assigned:
    iface: eth0:1
    ip: 195.201.251.122
Description

In our example, we assume we use the Hetzner cloud as they don't add a floating IP to a network interface automatically (like, for example, DigitalOcean does). We create a floating IP address on their web-interface, and a server. Then we assign the floating IP address to our new server, and boot it up. For details on how to do this manually check the Hetzner documentation.

Once this frecklet has run, you should be able to login to your server via the secondary IP address.

Command-line

frecklecute ipv4-address-assigned --help

Usage: frecklecute ipv4-address-assigned [OPTIONS]

  Add an IP address to an interface.

  This is often relevant for cloud services that offer so-called 'floating'
  IP addresses. Those are a useful, because you can point a dns record to
  them, and then easily switch the underlaying virtual machine. Otherwise
  you'd have to change the dns record, which would mean you'd have to wait
  for that change to propagate through all the dns layers. That usually
  takes a few hours, or even a day in some cases.

  This frecklet does not check whether the interface was already added at a
  different location than the value of ``iface_file_name``. Also, this only
  adds a very basic interface, in the form of:

  ``` auto <interface> iface <interface> inet static   address <ip>
  netmask 32 ```

  Currently this task also restarts the 'networking' service, independent of
  whether the interface was changed or not.

Options:
  --ip IP                         The ip to assign.  [required]
  --iface IFACE                   The name of the network interface.
  --iface-file-name IFACE_FILE_NAME
                                  The name of the interface file under
                                  /etc/network/interfaces.d.
  --help                          Show this message and exit.