Having issues adding a virtual interface with netplan

Rob

Administrator
Staff member
Joined
Oct 27, 2011
Messages
841
Reaction score
1,600
Credits
627
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:
[email protected]:/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?
 


f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
3,910
Reaction score
2,647
Credits
28,251
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
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
6,642
Reaction score
5,402
Credits
19,758
Let us know how it goes, Rob :)

Wiz
 

Adamantine

New Member
Joined
Jul 23, 2021
Messages
1
Reaction score
1
Credits
8
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
$100 Digital Ocean Credit
Get a free VM to test out Linux!


Top