Openvswitch - конфигурация хоста

Внешняя сеть

Конфигуратор сети /etc/network/interfaces.d/switch-public.cfg

# The primary network interface
allow-hotplug switch-public
iface switch-public inet static
  address 78..221166
  netmask 255.255.255.224
  gateway 78.142.221.190
  dns-nameservers 8.8.8.8 8.8.4.4

Внутренняя сеть

Последовательность команд для создания бриджей:

ovs-vsctl add-br switch-internal
ovs-vsctl add-br switch-internal vx1 -- set interface vx1 type=vxlan options:remote_ip=78.142.221.165
ovs-vsctl add-port switch-internal vx1 -- set interface vx1 type=vxlan options:remote_ip=78.142.221.165
ovs-vsctl add-port switch-internal vx1 -- set interface vx2 type=vxlan options:remote_ip=78.142.221.167
ovs-vsctl add-port switch-internal vx2 -- set interface vx2 type=vxlan options:remote_ip=78.142.221.167
ovs-vsctl show

Конфигуратор сети /etc/network/interfaces.d/switch-internal.cfg

allow-hotplug switch-internal
iface switch-internal inet static
  address 10.0.27.4
  netmask 255.255.255.0
#  up iptables -t nat -A POSTROUTING -o ens82f0 -j MASQUERADE

Примеры конфигураций

Конфигуратор /etc/network/interfaces.d/br-int.cfg

Вариант 1

auto eth0
iface eth0 inet manual
  ovs_bridge ovs-br
  ovs_type OVSPort

auto ovs-br
iface ovs-br inet static
  ovs_type OVSBridge
  ovs_port eth0
  address 10.0.10.21
  netmask 255.255.255.0
  gateway 10.0.10.1
  dns-nameservers 8.8.8.8 8.8.4.4

Вариант 2

auto eth0
iface eth0 inet manual
   up ip link set dev $IFACE up
   down ip link set dev $IFACE down

auto ovs-br
iface ovs-br inet static
  ovs_type OVSBridge
  ovs_port eth0
  address 10.0.10.21
  netmask 255.255.255.0
  gateway 10.0.10.1
  dns-nameservers 8.8.8.8 8.8.4.4

Вариант 3

auto eth0
iface eth0 inet manual
   up ip link set dev $IFACE up
   down ip link set dev $IFACE down

auto ovs-br
iface ovs-br inet static
  address 10.0.10.21
  netmask 255.255.255.0
  gateway 10.0.10.1
  dns-nameservers 8.8.8.8 8.8.4.4

Вариант 4

auto host-br-int
iface host-br-int inet static
  address 10.0.10.21
  netmask 255.255.255.0
  gateway 10.0.10.1
  dns-nameservers 8.8.8.8 8.8.4.4

ovs-vsctl add-br host-br-int
ovs-vsctl add-port host-br-int eth0
ifup host-br-int
cat /etc/network/interfaces
source /etc/network/interfaces.d/*.cfg

auto lo
iface lo inet loopback

Создание сетевых сущностей

ovs-vsctl add-bond ... 
ovs-vsctl set port <Имя бонда> lacp=active
ovs-vsctl add-bond host-br-int host-bond-int eth0 eth1

Опубликовано: 10.02.2022