openstack之kvm创建网桥

一、创建网桥

[root@template ~]# cd /etc/sysconfig/network-scripts/
[root@template ~]# cp ifcfg-eno16777736 ifcfg-eno16777736.bak  
[root@template ~]# ls
ifcfg-br0             
ifcfg-eno16777736 
ifcfg-eno16777736.bak  
#把ifcfg-eno16777736 拆成两个配置文件
[root@template network-scripts]# cat ifcfg-br0 
BOOTPROTO="static"
DEVICE="br0"
TYPE="Bridge"
NM_CONTROLLED="no"
IPADDR="192.168.30.131"
NETMASK=255.255.255.0
GATEWAY="192.168.30.2"
DNS1="8.8.8.8"
DNS2="114.114.114.114"

[root@template network-scripts]# cat ifcfg-eno16777736
NAME="eno16777736"
UU
BOOTPROTO="none"
DEVICE="eno16777736"
NM_CONTROLLED="no"
ONBOOT="yes"
BRIDGE="br0"

#重启服务

systemctl stop NetworkManager
systemctl disable NetworkManager
service network restart

#查看IP

[root@template network-scripts]# ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.30.131  netmask 255.255.255.0  broadcast 192.168.30.255
        inet6 fe80::20c:29ff:fe5c:1056  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:5c:10:56  txqueuelen 0  (Ethernet)
        RX packets 421244  bytes 1425530148 (1.3 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 238186  bytes 19220935 (18.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::20c:29ff:fe5c:1056  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:5c:10:56  txqueuelen 1000  (Ethernet)
        RX packets 1208601  bytes 1747719827 (1.6 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 321609  bytes 27120011 (25.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        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

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:49:15:64  txqueuelen 0  (Ethernet)
        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

vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::fc54:ff:fe17:c819  prefixlen 64  scopeid 0x20<link>
        ether fe:54:00:17:c8:19  txqueuelen 500  (Ethernet)
        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

vnet1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::fc54:ff:fe47:fee8  prefixlen 64  scopeid 0x20<link>
        ether fe:54:00:47:fe:e8  txqueuelen 500  (Ethernet)
        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)