OVSIntPort with Netplan

I'm looking the way to deal with OVSIntPort and netplan. I just want to configure the address, MTU and leave the other OVS things with ovs-vsctl which will be saved on OVSDB. Since Network Manager replace previously created OVSIntPort on OVSDB, so I must redefine it including its tag too (by using OVS_OPTIONS on ifcfg- script) if it was previously existing. This behavior is not happen with systemd-networkd. Should I move to systemd-networkd just for this OVSIntPort?

Best regards,


Solution 1:

I'm not sure if I understand the question correctly, but if you're using Netplan v0.100 (currently in Ubuntu Groovy & Focal -proposed) you could be using Netplan's native Open vSwitch support to create OVS ports/interfaces.

For example (OVS Bridge: ovs0):

network:
    version: 2
    renderer: networkd
    openvswitch:
        ports: # to create OVS internal patch ports
            - [patch0-1, patch1-0]
    ethernets:
        eth0: {} # physical ethernet interface
    bridges:
        ovs0:
            addresses: [192.168.0.10/24]
            interfaces: [patch0-1, eth0]
            mtu: 9000
            openvswitch: {} # this is an OVS port

Netplan, using the systemd-networkd renderer, can create OVS patch-ports, bridges, bonds and (vlan) fake bridges for you, using ovs-vsctl in the background. You can then modify OVSDB according to your needs via individual ovs-vsctl commands.

For further reference, please have a look at the netplan/OVS documentation and the OVS example below: https://netplan.io/reference/#common-properties-for-physical-device-types https://github.com/CanonicalLtd/netplan/blob/master/examples/openvswitch.yaml

Solution 2:

I stumbled upon the same sutiation lately. And thanks to Lukas Maerdian's answer I made it to understand what he ment by it. So in the end my config for netplan was like this:

network:
  ethernets:
    real_ethernet_port0: {some regular parameters}
    real_ethernet_port1: {some regular parameters}
  bridges:
    your_ovs_int_port:
      openvswitch: {}
      dhcp4: false
      addresses: [192.168.1.1/24]
      gateway4: 192.168.1.1
      and so on...

You see, the catch is to nest it under bridges: category (not ethernets!) and it has to have this openvswitch: {} line. Which btw can have other different parameters, pls follow Lukas's links. What author meant is we have already configured virtual switch via ovs-vsctl with ovs internal ports created automatically. The only thing is to configure address via netplan because system clears it after reboot if you configured it through ifconfig or ip address add commands in shell.