Configure netplan after deployment


#1

Hello,

On Ubuntu 16, simply change /etc/network/interfaces.d/50-cloud-init.cfg with my settings and reboot was working.
On ubuntu 18 when I’m trying to set my netplan configuration in /etc/netplan/01-netcfg.yaml, then “sudo netplan apply”, it does not work, the node keep the default route and gateway on maas port that I don’t want and I did remove it in my configuration.
What is the good way to proceed then ?
Also should I set a renderer in 01-netcfg.yaml like networkd ? It is no set by default.
I’m using version 2.5.0

Here is my netplan config :

Thank you,
Ludwig


#2

I tried something else.

After my deployment I just have a default route via maas interface that I don’t want.

If I manually create my vlans with just these commands :

ifconfig bond0 up
ip link add link bond0 bond0.170 type vlan id 170
ip link add link bond0 bond0.186 type vlan id 186

Then :
route_netplan

My bondings go up using the good ip direcly from my netplan file, so everything looks ok from kernel module or vlan package and my netplan configuration is readable by the system, it is just netplan that can’t bring my interfaces up.
And of course this does not persist after a reboot.


#3

Have you tried executing the netplan apply command with the debug flag, e.g.:

sudo netplan --debug apply

I’ve observed that changes are not applied if a device is still up/being used. So just ifconfig interface down and then applying the changes works (but you get that info from the --debug flag).


#4

Yes I use “–debug” but I’m not sure if results are revelant.
I tried to turn off every interfaces except the one to maas as you suggested, and then run “sudo netplan --debug apply”.

It still does not bring my bonds up, here is the output :

$ sudo netplan --debug apply
** (generate:2096): DEBUG: 16:54:26.304: Processing input file /etc/netplan/50-cloud-init.yaml…
** (generate:2096): DEBUG: 16:54:26.305: starting new processing pass
** (generate:2096): DEBUG: 16:54:26.305: bond0.186: setting default backend to 1
** (generate:2096): DEBUG: 16:54:26.305: enp1s0f0: setting default backend to 1
** (generate:2096): DEBUG: 16:54:26.305: enp179s0f0: setting default backend to 1
** (generate:2096): DEBUG: 16:54:26.305: enp179s0f1: setting default backend to 1
** (generate:2096): DEBUG: 16:54:26.305: bond0: setting default backend to 1
** (generate:2096): DEBUG: 16:54:26.305: bond0.170: setting default backend to 1
** (generate:2096): DEBUG: 16:54:26.305: Generating output files…
** (generate:2096): DEBUG: 16:54:26.306: NetworkManager: definition bond0.186 is not for us (backend 1)
** (generate:2096): DEBUG: 16:54:26.306: NetworkManager: definition enp1s0f0 is not for us (backend 1)
** (generate:2096): DEBUG: 16:54:26.306: NetworkManager: definition enp179s0f0 is not for us (backend 1)
** (generate:2096): DEBUG: 16:54:26.306: NetworkManager: definition enp179s0f1 is not for us (backend 1)
** (generate:2096): DEBUG: 16:54:26.306: NetworkManager: definition bond0 is not for us (backend 1)
** (generate:2096): DEBUG: 16:54:26.306: NetworkManager: definition bond0.170 is not for us (backend 1)
DEBUG:netplan generated networkd configuration exists, restarting networkd
DEBUG:no netplan generated NM configuration exists
DEBUG:enp1s0f0 not found in {}
DEBUG:enp179s0f0 not found in {‘enp1s0f0’: {‘match’: {‘macaddress’: ‘a0:42:3f:38:84:14’}, ‘set-name’: ‘enp1s0f0’, ‘mtu’: 1500, ‘addresses’: [‘192.168.172.40/24’]}}
DEBUG:enp179s0f1 not found in {‘enp1s0f0’: {‘match’: {‘macaddress’: ‘a0:42:3f:38:84:14’}, ‘set-name’: ‘enp1s0f0’, ‘mtu’: 1500, ‘addresses’: [‘192.168.172.40/24’]}, ‘enp179s0f0’: {‘match’: {‘macaddress’: ‘3c:fd:fe:d2:69:50’}, ‘set-name’: ‘enp179s0f0’, ‘mtu’: 9000}}
DEBUG:bond0 not found in {}
DEBUG:bond0.170 not found in {}
DEBUG:bond0.186 not found in {‘bond0.170’: {‘id’: 170, ‘link’: ‘bond0’, ‘addresses’: [‘192.168.170.114/24’], ‘gateway4’: ‘192.168.170.1’, ‘nameservers’: {‘search’: [’ domain.net’, ’ domain.lan’], ‘addresses’: [‘192.168.170.100’, ‘192.168.170.101’]}, ‘mtu’: 9000}}
DEBUG:Merged config:
network:
bonds:
bond0:
dhcp4: false
dhcp6: false
interfaces:
- enp179s0f0
- enp179s0f1
parameters:
mii-monitor-interval: 100
mode: balance-xor
bridges: {}
ethernets:
enp179s0f0:
match:
macaddress: 3c:fd:fe:d2:69:50
mtu: 9000
set-name: enp179s0f0
enp179s0f1:
match:
macaddress: 3c:fd:fe:d2:69:51
mtu: 9000
set-name: enp179s0f1
enp1s0f0:
addresses:
- 192.168.172.40/24
match:
macaddress: a0:42:3f:38:84:14
mtu: 1500
set-name: enp1s0f0
vlans:
bond0.170:
addresses:
- 192.168.170.114/24
gateway4: 192.168.170.1
id: 170
link: bond0
mtu: 9000
nameservers:
addresses:
- 192.168.170.100
- 192.168.170.101
search:
- domain.net
- domain.lan
bond0.186:
addresses:
- 192.168.186.64/24
id: 186
link: bond0
mtu: 9000
wifis: {}

DEBUG:Skipping non-physical interface: lo
DEBUG:Skipping composite member enp179s0f0
DEBUG:Skipping composite member enp179s0f1
DEBUG:device enp1s0f0 operstate is up, not changing
DEBUG:Skipping non-physical interface: enp1s0f1
DEBUG:Skipping non-physical interface: enp0s20f0u2u2c2
DEBUG:Skipping non-physical interface: bond0
DEBUG:{}
DEBUG:netplan triggering .link rules for lo
DEBUG:netplan triggering .link rules for enp179s0f0
DEBUG:netplan triggering .link rules for enp179s0f1
DEBUG:netplan triggering .link rules for enp1s0f0
DEBUG:netplan triggering .link rules for enp1s0f1
DEBUG:netplan triggering .link rules for enp0s20f0u2u2c2
DEBUG:netplan triggering .link rules for bond0

After that I just have my maas interface that is up, as it was before applying netplan.


#5

The only thing I see is: DEBUG:device enp1s0f0 operstate is up, not changing which could be a problem. Can you deactivate that interface before applying your changes?


#6

So I went on IPMI console, shutdown the interface and ran the “sudo netplan --debug apply”
Here is a screenshot :

With the same result… only the enp1s0f0 goes up, nothing about others and bonding.


#7

I solved that problem adding mtu: 9000 under “bond0” section (in additions of others place it already was)

   bond0:
      mtu: 9000
      dhcp4: false
      dhcp6: false
      interfaces: [ enp59s0f0, enp59s0f1 ]
      parameters:
        mode: balance-xor
        mii-monitor-interval: 100