How to configure Open vSwitch bridge for OpenStack

Updated on December 7, 2022

Followed the guide from server-world for installing the OpenStack Train version on the CentOS server. Configuring neutron services requires physical access to the terminal, as it requires a restart of the network services. But sometimes, you don’t get to be present in front of the physical terminal and end up having only remote access (and there are chances you might end up losing the network connection when network services are restarted). For example, when you create a bridge and map it to the local interface the connection might be dropped. So in this article, we will explore how to configure the Open vSwitch bridge for OpenStack via SSH access to the remote machine.

Open vSwitch (OvS) is a multilayer software switch well suited to function as a virtual switch in VM environments. It is designed to enable massive network automation through programmatic extension, while still supporting standard management interfaces and protocols (e.g. NetFlow, sFlow, IPFIX, RSPAN, CLI, LACP, 802.1ag).  In addition to exposing common control and visibility interfaces to the virtual networking layer, it was designed to support distribution across multiple physical servers. Open vSwitch supports multiple Linux-based virtualization technologies including KVM and VirtualBox.

Step 1: Install Open vSwitch

The first step is to install the Open vSwitch package. If you have installed it already, ignore this step.

Note: Add OpenStack repo. In my case I used Train version.

# yum -y install centos-release-openstack-train

# yum --enablerepo=centos-openstack-train,epel -y install openstack-neutron-openvswitch

Step 2: Start and enable the Open vSwitch service

# systemctl start openvswitch

# systemctl enable openvswitch

Step 3: Confirm ovs-vsctl is able to talk to the Open vSwitch service

# ovs-vsctl show
  cbbdea93-7224-43ab-ae42-1777525549c1
      ovs_version: "2.12.0"

Step 4: Install Network scripts and disable NetworkManager

# yum -y install network-scripts

Note: Don’t worry if you see “No package network-scripts available” error. If you find the directory, /etc/sysconfig/network-scripts, then you can skip this step.

# systemctl disable --now NetworkManager

# systemctl enable network
network.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig network on

Step 5: Create an Open vSwitch bridge for OpenStack VMs

Back up the current interface configurations. Replace the interface name appropriately.

# cp /etc/sysconfig/network-scripts/ifcfg-enp4s0f0 /root/

Configure the physical interface as below. Replace the interface name appropriately.

# vim /etc/sysconfig/network-scripts/ifcfg-enp4s0f0
DEVICE=enp4s0f0
ONBOOT=yes
TYPE=OVSPort
DEVICETYPE=ovs
OVS_BRIDGE=br-enp4s0f0

Create the bridge configuration. Replace the interface name, IP address, subnet, Gateway, DNS1 & DNS2 appropriately.

# vim /etc/sysconfig/network-scripts/ifcfg-br-enp4s0f0
DEVICE=br-enp4s0f0
BOOTPROTO=none
ONBOOT=yes
TYPE=OVSBridge
DEVICETYPE=ovs
USERCTL=yes
PEERDNS=yes
IPV6INIT=no
IPADDR=192.168.20.10
NETMASK=255.255.255.0
GATEWAY=192.168.20.1
DNS1=192.168.20.1
DNS2=8.8.8.8

Create the bridge. Map the bridge to the physical interface. Restart the network service. Replace the interface name appropriately.

# ovs-vsctl add-br br-enp4s0f0
# ovs-vsctl add-port br-enp4s0f0 enp4s0f0 && systemctl restart network

Note: This would map the bridge to the physical interface and restart the network without losing the remote connection.

Step 6: Verify the bridge

# ovs-vsctl show
# ip addr

Continue with other neutron configurations as in server-world.

Was this article helpful?

Related Articles

Leave a Comment