openEuler

系统环境

系统:openEuler 20.3 LTS
平台:amd64

参考文献

OVS 配置虚机vlan
openEuler 准备使用环境

安装Open vSwitch

yum install -y openvswitch
systemctl start openvswitch
systemctl enable openvswitch

创建网桥

  1. 创建网桥
# 创建Open vSwitch网桥br0
ovs-vsctl add-br br0
# 将物理网卡eth0添加到br0
ovs-vsctl add-port br0 eno1
ovs-vsctl show
  1. 为网桥配置静态IP地址
    修改eno1网卡配置
    编辑/etc/sysconfig/network-scripts/ifcfg-eno文件,用以下内容覆盖原内容
DEVICE="eno1"
ONBOOT="yes"
NM_CONTROLLED="no"

创建br0配置文件

vim /etc/sysconfig/network-scripts/ifcfg-br0

写入以下内容

TYPE="Ethernet"
DEVICE="br0"  
ONBOOT=yes
NETBOOT=yes
BOOTPROTO=static
NM_CONTROLLED="no"
IPADDR=192.168.1.120
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=114.114.114.114
DNS2=223.5.5.5
## ipv6配置
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6ADDR=fe80::160/64

重启网络

systemctl restart network

debian

系统环境

系统:debian 10.7
平台:amd64

安装Open vSwitch

apt install openvswitch-switch
systemctl start openvswitch-switch
systemctl enable openvswitch-switch

创建网桥

  1. 创建网桥
# 创建Open vSwitch网桥br0
ovs-vsctl add-br br0
# 将物理网卡eth0添加到br0
ovs-vsctl add-port br0 eno1
ovs-vsctl show
  1. 为网桥配置静态IP地址
    修改eno1网卡配置
    编辑/etc/network/interfaces文件,将eno1网卡修改如下
# The primary network interface
allow-hotplug eno1
iface eno1 inet manual
# This is an autoconfigured IPv6 interface
iface eno1 inet6 manual

并末尾添加br0的ip地址配置

# br
auto br0
iface br0 inet static
address 192.168.1.120
broadcast 192.168.1.255
netmask 255.255.255.0
gateway 192.168.1.1
# IPv6
iface br0 inet6 static
address fe80::160
netmask 64
gateway fe80::1

重启网络

systemctl restart network
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐