0

I have VPS server with Ubuntu 18.04. I have problem with my configuration file : 50-cloud-init.yaml. I have additional FailOver IP's on my server and I want create separate interfaces (1 IP - 1 interface) to use them after on python project.

For example, my server IP(which I use to connect by SSH) is : 12.34.12.456

Firstly my config looks like:

network:
    version: 2
    ethernets:
        ens3:
            dhcp4: true
            match:
                macaddress: xx:xx:xx:xx:xx:xx
            set-name: ens3

My ip on server is : 12.34.12.456

I add 'addresses' with my FAIL OVER IP's and now my config file looks like:

network:
    version: 2
    ethernets:
        ens3:
            dhcp4: true
            match:
                macaddress: xx:xx:xx:xx:xx:xx
            set-name: ens3
            addresses:
            - IP.FAIL.OVER.1/32
            - IP.FAIL.OVER.2/32
            - IP.FAIL.OVER.3/32

My ip now on server is : IP.FAIL.OVER.1

I try change my config file to:

network:
    version: 2
    ethernets:
        ens1:
            dhcp4: true
            match:
                macaddress: xx:xx:xx:xx:xx:xx
            set-name: ens3
            addresses:
            - IP.FAIL.OVER.1/32
        ens2:
            dhcp4: true
            match:
                macaddress: xx:xx:xx:xx:xx:xx
            set-name: ens3
            addresses:
            - IP.FAIL.OVER.2/32
        ens3:
            dhcp4: true
            match:
                macaddress: xx:xx:xx:xx:xx:xx
            set-name: ens3
            addresses:
            - IP.FAIL.OVER.3/32

After changes config file i use:

sudo netplan apply

but it's not changing interfaces on 'ifconfig'. My ip on server is still IP.FAIL.OVER.1 (but name of interface points to IP.FAIL.OVER.3).

I find similar topics where somebody suggest to check status on networkmanager, but I don't have networkmanager of service's list.

After sudo netplan --debug generate i get:

 DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:8801): DEBUG: 13:23:27.733: Processing input file /etc/netplan/50-cloud-init.yaml..
** (generate:8801): DEBUG: 13:23:27.734: starting new processing pass
** (generate:8801): DEBUG: 13:23:27.734: ens1: setting default backend to 1
** (generate:8801): DEBUG: 13:23:27.734: Configuration is valid
** (generate:8801): DEBUG: 13:23:27.734: ens2: setting default backend to 1
** (generate:8801): DEBUG: 13:23:27.734: Configuration is valid
** (generate:8801): DEBUG: 13:23:27.735: ens3: setting default backend to 1
** (generate:8801): DEBUG: 13:23:27.735: Configuration is valid
** (generate:8801): DEBUG: 13:23:27.735: Generating output files..
** (generate:8801): DEBUG: 13:23:27.735: NetworkManager: definition ens1 is not for us (backend 1)
** (generate:8801): DEBUG: 13:23:27.735: NetworkManager: definition ens2 is not for us (backend 1)
** (generate:8801): DEBUG: 13:23:27.735: NetworkManager: definition ens3 is not for us (backend 1)

Somebody have idea how add new interfaces with FO IP's properly?

0

The ifconfig command does not show complete information about multiple addresses on an interface - it will only show you one ipv4 address at a time - and should be considered deprecated in favor of ip addr show.

The address assignments have almost certainly been successful, you're just not querying them correctly.

You should definitely not configure multiple interface stanzas in netplan which all match the same physical device; the behavior of such a config is undefined.

  • Thanks for response. So how configure a few interfaces with few IP addresses to switch between them? – Bob Jul 19 at 11:49
  • Your original approach, with multiple ips in an addresses: block, is correct. – slangasek Jul 20 at 14:36
  • Yes? But how take control from which IP I make connect? – Bob Jul 23 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.