On 18.04, I have figured out how to get bonds, vlans, and bridges all working similarly to ifupdown. However, I am running a KVM server, and need the ability to add tagged vlan interfaces on the fly and bring them up individually without interrupting networking on the production box.

For example, ifup vlan123

However, it seems if I ran netplan apply to apply changes to yaml file, networking is interrupted to the server for at least 10-15 seconds. This would not bode well for production boxes.

Is there a way to add new vlans on the fly and bring them up without interrupting networking to the whole server?

Many thanks in advance.

  • 1
    Good question! Not sure the answer here, but here's something that seems similar in nature: serverfault.com/questions/972956/… – Terrance Sep 4 '19 at 22:27
  • 1
    Thank you, although looks like this poster just replaced netplan with ifupdown. Would prefer to stick with netplan, if possible, as it seems that is the preferred method going forward. – jubjub Sep 5 '19 at 20:27
  • To me this is arguably a possible bug in systemd-networkd. Could you please file a bug in Launchpad about this, along with an example config where you'd want to add a VLAN, for example, so we can reproduce how it reloads things? – Mathieu Trudel-Lapierre Sep 5 '19 at 20:52
  • Will do! Thank you very much. In the meantime I have uninstalled netplan and gone back to ifupdown to maintain the ability to dynamically add new vlans. I used this page as a guide >> askubuntu.com/questions/1031709/… – jubjub Sep 6 '19 at 18:48

You can do this using ip commands:

sudo ip link add  link enp3s0 lan3 type vlan id 101

The above adds a new VLAN to enp3s0, using VLAN ID 101, named lan3.

You'd then want to add that VLAN to the netplan YAML as well, so it is persistant across reboots.

From there, you can also add addresses to the interface or do other manipulations necessary to bring up the interface:

sudo ip addr add dev lan3

Additionally, you may want to add:

critical: true

To an interface if the issue is that it will rerequest an IP from DHCP. That field in netplan tells systemd-networkd not to bring it down at all, it might help here.

  • You are legend! Thanks Mathieu! I saw this after I removed netplan, but promptly reinstalled and tried the above. Works like a charm! However, It would be great to not lose connectivity on all interfaces when running a netplan apply. Will file a bug in Launchpad – jubjub Sep 6 '19 at 20:38

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.