What is the proper way to setup Open vSwitch with NetworkManager in CentOS 8?
How it was before in good old times of network-scripts
:
I've describing bridge and port in files:
/etc/sysconfig/network-scripts/ifcfg-br0
/etc/sysconfig/network-scripts/ifcfg-port0
than restart network by
systemctl restart network
and everything start working.
Now network-scripts
is marked as deprecated, there is a warning that will be removed in one of the next major releases of RHEL.
, so I have to switch to NetworkManager, right?
But how to setup Open vSwitch with NetworkManager?
I've installed NetworkManager-ovs
and trying this guide but described commands doing nothing, I mean nothing appears in output of ovs-vsctl show
nmcli networking off && nmcli networking on
or systemctl restart NetworkManager
has no any effect
ifup br0
also does not work:
Error: unknown connection '/etc/sysconfig/network-scripts/ifcfg-br0'.
Solution 1:
Creating a Bridge with a single internal Interface
$ nmcli conn add type ovs-bridge conn.interface bridge0
Connection 'ovs-bridge-bridge0' (d10fc64d-1d48-4394-a1b8-e1aea72f27d5) successfully added.
$ nmcli conn add type ovs-port conn.interface port0 master bridge0
Connection 'ovs-port-port0' (5ae22bae-bba4-4815-9ade-7e635633e1f0) successfully added.
$ nmcli conn add type ovs-interface slave-type ovs-port conn.interface iface0 \
master port0 ipv4.method manual ipv4.address 192.0.2.1/24
Connection 'ovs-interface-iface0' (3640d2a1-a2fd-4718-92f1-cffadb5b6cdc) successfully added.
You need to create a Port even for a single interface. Also, before you add the Interface, the Bridge and Port devices appear active, but are not configured in OVSDB yet. You can inspect the results with ovs-vsctl show.
Adding a Linux interface to a Bridge
$ nmcli conn add type ovs-port conn.interface port1 master bridge0
Connection 'ovs-port-port1' (67d041eb-8e7b-4458-afee-a1d07c9c4552) successfully added.
$ nmcli conn add type ethernet conn.interface eth0 master port1
Connection 'ovs-slave-eth0' (d459c45c-cf78-4c1c-b4b7-505e71379624) successfully added.
Now run ovs-vsctl show and check it.