2

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.

jubjub
  • 23
  • 1
    Good question! Not sure the answer here, but here's something that seems similar in nature: https://serverfault.com/questions/972956/netplan-doesnt-configure-vlan-on-hotplug-of-underlying-link – Terrance Sep 04 '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 05 '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 05 '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 >> https://askubuntu.com/questions/1031709/ubuntu-18-04-switch-back-to-etc-network-interfaces – jubjub Sep 06 '19 at 18:48

1 Answers1

1

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 10.10.10.3/17

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 06 '19 at 20:38