View on GitHub

Ment.Niu

To eke out a living Live is better than burning

CentOS7 配置ovs网桥

配置ovs port eth0

编辑/etc/sysconfig/network-scripts/ifcfg-eth0


DEVICE=eth0
ONBOOT=yes
DEVICETYPE=ovs
TYPE=OVSPort
OVS_BRIDGE=ovsbr0
BOOTPROTO=none
HOTPLUG=no

配置ovs br ovsbr0 dhcp方式

编辑/etc/sysconfig/network-scripts/ifcfg-ovsbr0


DEVICE=ovsbr0
ONBOOT=yes
DEVICETYPE=ovs
TYPE=OVSBridge
OVSBOOTPROTO="dhcp"
OVSDHCPINTERFACES="eth0"
HOTPLUG=no

配置ovs br ovsbr0 static方式



DEVICE=ovsbr0
ONBOOT=yes
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=static
IPADDR=10.211.55.11
NETMASK=255.255.255.0
HOTPLUG=no

重启网络,查看ifconfig和ovs-vsctl show


[root@localhost network-scripts]# ifconfig
eth0: flags=4163  mtu 1500
        ether 00:1c:42:79:60:28  txqueuelen 1000  (Ethernet)
        RX packets 706  bytes 55888 (54.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 207  bytes 43479 (42.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        loop  txqueuelen 0  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ovsbr0: flags=4163  mtu 1500
        inet 10.211.55.11  netmask 255.255.255.0  broadcast 10.211.55.255
        inet6 fe80::21c:42ff:fe79:6028  prefixlen 64  scopeid 0x20
        inet6 fdb2:2c26:f4e4:0:21c:42ff:fe79:6028  prefixlen 64  scopeid 0x0
        ether 00:1c:42:79:60:28  txqueuelen 0  (Ethernet)
        RX packets 706  bytes 55888 (54.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 205  bytes 43323 (42.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost network-scripts]# ovs-vsctl show 
1db31584-cd5e-416a-887d-7ef5c277fde5
    Bridge "ovsbr0"
        Port "ovsbr0"
            Interface "ovsbr0"
                type: internal
        Port "eth0"
            Interface "eth0"
    ovs_version: "2.3.0"