1. 配置bond网络接口
1)命令方式配置
首先要创建两个网卡
点灯泡点开,右键add,Network,第三个选择virtio,网卡创建完成。
nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.(120)/24
创建好后可监控watch -n 1 cat /proc/net/bonding/bond0
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
ifconfig eth0 down 停止这个网络
ifconfig eth0 up 开启这个网络
2)编辑文件方式配置
cd /etc/sysconfig/network-scripts
vim ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.(120)
PREFIX=24
TYPE=Bond
BONDING_OPTS=mode=active-backup
BONDING_MASTER=yes
systemctl restart network 重启网络
创建bond0成功
vim ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
同样创建vim ifcfg-eth1
systemctl restart NetworkManager 重启网络
添加eth0 eth1成功
2.配置team网络接口
Team的种类
broadcast 广播容错
roundrobin 平衡轮叫
activebackup 主备
loadbalance 负载均衡
1)命令方式配置
nmcli connection add con-name team0 ifname team0 type team config ‘{“runner”:{“name”:“activebackup”}}’ ip4 172.15.254.120/24
teamdctl team0 stat 查看team网络
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
创建完成
2)文件脚本方式配置
cd /etc/sysconfig/network-scripts
vim ifcfg-team0
DEVICE=team0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.120
PREFIX=24
TEAM_CONFIG=’{“runner”:{“name”:“activebackup”}}’
TYPE=Team
systemctl restart network 重启网络
vim ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
DEVICETYPE=TeamPort
TEAM_MASTER=team0
同样创建eth1
systemctl restart network 重启网络
添加eth0 eth1成功
teamdctl team0 stat 查看team网络
3.配置网络桥接
1)编辑文件脚本配置
cd /etc/sysconfig/network-scripts/
vim ifcfg-enp0s25
DEVICE=enp0s25
ONBOOT=yes
BOOTPROTO=none
BRIDGE=br0
vim ifcfg-br0
TYPE=Bridge
DEVICE=br0
BOOTPROTO=none
IPADDR=172.25.254.20
PREFIX=24
ONBOOT=yes
systemctl stop NetworkManager.service
systemctl restart network
2)命令方式管理br0接口
brctl show 查看桥接接口状态
brctl addbr br0 添加br0接口
brctl addif br0 enp0s25 使br0接口与enp0s25网卡联通
brctl delif br0 enp0s25 从enp0s25上摘除br0
brctl delbr br0 删除br0