読者です 読者をやめる 読者になる 読者になる

AKAI TSUKI

System development or Technical something

setup bridge device on CentOS 7, by use OVS

add bridge device by ovs-vsctl

[root@kvmtest ~]# ovs-vsctl add-br br0
[root@kvmtest ~]# ovs-vsctl add-port br0 enp0s3

ifcfgenp0s3 interface configuration file

[root@kvmtest ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
DEVICE=enp0s3
NAME=enp0s3
BOOTPROTO=none
UUID=289182bb-48c3-40e7-b3cd-77423569fc7a
ONBOOT=yes
NM_CONTROLLED=no
DEVICETYPE=ovs
TYPE=OVSPort
OVS_BRIDGE=br0
[root@kvmtest ~]# 

ifcfg-br0 interface configuration file

[root@kvmtest ~]# cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
NAME=br0
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLD=NO
DEVICETYPE=ovs
TYPE=OVSBridge
IPADDR=192.168.0.240
PREFIX=24
GATEWAY=192.168.0.1
DNS1=8.8.8.8
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
[root@kvmtest ~]#

reboot

[root@kvmtest ~]# reboot
[root@kvmtest ~]# ovs-vsctl show
bbf32677-0b6c-46f4-8734-e8705c5cbe80
    Bridge "br0"
        Port "br0"
            Interface "br0"
                type: internal
        Port "enp0s3"
            Interface "enp0s3"
    ovs_version: "2.6.1"
[root@kvmtest ~]#
[root@kvmtest ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master ovs-system state UP qlen 1000
    link/ether 08:00:27:32:47:47 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::a00:27ff:fe32:4747/64 scope link
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:15:48:81 brd ff:ff:ff:ff:ff:ff
4: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether ee:bf:5d:00:ba:06 brd ff:ff:ff:ff:ff:ff
5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN qlen 1000
    link/ether 08:00:27:32:47:47 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.240/24 brd 192.168.0.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::c8ea:adff:fea9:7548/64 scope link
       valid_lft forever preferred_lft forever
[root@kvmtest ~]#