高级网络配置
链路聚合
一个主机可以使用多个网卡
bond 0:平衡轮循 1:主动备份 ##主动备份模式最多可支持2块网卡
nmcli connection show ##查看网卡接口
nmcli cinnection delete eth0 ##删除已有网卡接口
创建bond0
nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.105/24
创建eth0
nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0
创建eth1
nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0
watch -n 1 cat /proc/net/bonding/bond0
ifconfig eth0 down
ifconfig eth0 up
ifconfig eth1 down
ifconfig eth1 up
team ##主动备份模式最多可支持8块网卡
创建team0
nmcli connection add con-name team0 ifname team0 type team config '{"runner":{"name":"activebackup"}}'
创建eth0
nmcli connection add con-name eth0 ifname eth0 type team-slave master team0
创建eth1
nmcli connection add con-name eth1 ifname eth1 type bond-slave master team0
网络桥接 ##虚拟机可以直接通过物理网卡进行数据传输
vim /etc/sysconfig/network-scripts/ifcfg-eth0
1 BOOTPROTO=none
2 DEVICE=enp0s25
3 ONBOOT=yes
4 BRIDGE=br0
vim /etc/sysconfig/network-scripts/ifcfg-br0
1 DEVICE=br0
2 ONBOOT=yes
3 BOOTPROTO=none
4 IPADDR=172.25.254.5
5 PREFIX=24
6 TYPE=Bridge
brctl show ##显示网桥信息
临时搭建网桥
brctl addbr br0
ifconfig br0 172.25.254.105/24
brctl addif br0 eth0
brctl delif br0 eth0
brctl delbr br0