NAT:虚拟机把数据先转发给真机,真机再通过网卡传输,所以速度较慢
1.网桥配置
###cd /etc/sysconfig/network-scripts/
***ifcfg-br0是网桥配置文件,ifcfg-enp4s0f1是网卡配置文件***
进行该实验时需将二者删除(模拟环境,将其移走)###
(1)vim ifcfg-enp4s0f1
DEVICE=enp4s0f1
ONBOOT=yes
BOOTPROTO=none
BRIDGE=br0
(2)vim ifcfg-br0
DEVICE=br0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.81
NETMASK=255.255.255.0
TYPE=Bridge
(3)systemctl restart network
ping通,则证明网桥已连接好
临时添加:
brctl addbr br0 ---添加网桥
ifconfig br0 172.25.254.240 netmask 255.255.255.0
brctl addif br0 eth0 ---添加网桥连接
brctl show ---显示网桥
删除:
ifconfig br0 down
brctl delif br0 eth0
brctl delbr br0
2.bond
BOND ---链路聚合,最多值支持2块网卡,将两块网卡绑定到一个通道,根据不同模式增加带宽或冗余性
(1)bond1---主动备份---容错,一次使用一个,一个坏了,另一个立即接替
给虚拟机加两块网卡
添加:
nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.140/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
cat /proc/net/bonding/bond0 ---查看
删除:
ifconfig eth0 down
nmcli connection delete eth0
为验证当正在工作的网卡损坏,另一块会会顶替工作,现删除一网卡。
可见eth1已顶替其工作
(2)bond0---平衡轮循---循环策略,你一个我一个,循环来
(3)bond3---广播---容错
3、TEAM ---最多支持8快网卡
添加:
nmcli connection add con-name team0 type team ifname team0 config '{"runner":{"name":"activebackup"}}' ip4 172.25.254.239/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
teamctl team0 state ----查看team