1:为虚拟机添加第二块网卡
2:删除虚拟机原有的网络配置 ##nmcli connection delete eth0
nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.103/24
nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0
nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0
watch -n 1 cat /proc/net/bonding/bond0 #####bonding目录下的文件全部是bond0的信息
在监控命令下打开另外一个shell 关闭使用中的网卡设备,可以看到备用网卡直接顶替关掉的网卡
ifconfig eth0 down ###关掉网卡设备
二:######team#########
1:删掉bond0网络配置和eth0.1
nmcli connection add con-name team0 ifname team0 type team config '{"runner":{"name":"activebackup"}}' ip4 172.25.254.103/24
nmcli connection add con-name eth0 ifname eth0 type team-slave master team0
nmcli connection add con-name eth1 ifname eth1 type team-slave master team0
watch -n 1 cat teamdctl team0 stat
5:在监控命令下打开另外一个shell 关闭使用中的网卡设备,可以看到备用网卡直接顶替关掉的网卡ifconfig eth0 down ###关掉网卡设备
三:########搭建网桥#### ####在真机里面做###
1:进入 /etc/sysconfig/network-scripts
mv ifcfg-br0 ifcfg-enp0s31f6 /opt
2:nm-connectin-editor
删掉除了virtio以外其他的所有东西
3:重新设定一个网络然后重启
4:vim ifcfg-enp0s31f6
写入:
DEVICE=enp0s31f6
ONBOOT=yes
BOOTPROTO=none
BRIDGE=br0
5:vim ifcfg-br0
写入:
DEVICE=br0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.66.250
PREFIX=24
TYPE=Bridge
6:systemctl stop NetworkManager.service
systemctl restart network
7:brctl show
验证网桥是否搭建成功
virt-manager
安装虚拟机看可不可以选择br0一行
四:########虚拟机中#####
1:brctl addbr br0 添加
brctl show
ifconfig
ifconfig br0 172.25.254.103/24
ifconfig br0
ping 172.25.254.3 ping不通
brctl addif br0 eth0 将br0桥接在eth0上
ping 172.25.254.3 可以ping通
ifconfig br0 down
brctl delbr br0###########删除桥接