Having issues adding a virtual interface with netplan

Rob

Administrator
Staff member
Joined
Oct 27, 2011
Messages
1,210
Reaction score
2,240
Credits
3,485
Hey there,

I'm working with a group of openvpn ubuntu servers that use eth0 as their main interface, then when openvpn is started, it brings up tun0, tun1, tun2 ..

Anyway, I'm trying to add a 2nd private ip on eth0 as 'eth0:0' but this is Ubuntu 18.04 which uses netplan now..

So, in /etc/netplan/50-cloud-init.yaml is:

Code:
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            dhcp4: true
            dhcp4-overrides:
                route-metric: 100
            dhcp6: false
            match:
                driver: hv_netvsc
                macaddress: 00:0d:3a:a5:3c:48
            set-name: eth0
    version: 2

I tried this:

Code:
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            dhcp4: true
            dhcp4-overrides:
                route-metric: 100
            dhcp6: false
            match:
                driver: hv_netvsc
                macaddress: 00:0d:3a:a5:3c:48
            set-name: eth0
            addresses:
                - 10.0.0.1/24:
                    lifetime: 0
                    label: "eth0:0"
    version: 2
(after reading online a little)

but getting the following error after running 'netplan apply'
Code:
root@gwvpn-prod-centralus-az1-vm:/etc/netplan# netplan apply
/etc/netplan/50-cloud-init.yaml:18:19: Error in network definition: expected scalar
                - 10.0.0.1/24:
                  ^

Any ideas?
 


Isn't netplan just a front-end for NetworkManager, at least on Ubuntu 20.04 it is don't know about 18.04. Why not use NetworkManager directly? Try using the debug option.
Code:
netplan --debug apply
 
Let us know how it goes, Rob :)

Wiz
 
Hello Rob, please note that you use "label" parameter, this feature is available from netplan < 100 version. Upgrade your neplan to the latest version (min 100) and then you will can apply your configuration in netplan.
 
Last edited:
  • Like
Reactions: Rob

Staff online

Members online


Latest posts

Top