一、网络桥接
桥接指的是在主机网卡上重新打开一个接口,分别连接主机和虚拟机,使虚拟机和真机处于同一个网段,降低网络延迟;
1、真实网卡配置:
2、桥接网卡配置:
3、临时添加br0接口:
brctl addbr br0 添加接口
ifconfig br0 ip 配置ip
brctl addif br0 eth0 使br0连接到eth0
4、删除临时设定:
ifconfig br0 down
brctl delbr br0
二、链路聚合
1、bond链路聚合
设定:
清理所有网卡
nmcli connection delete
添加聚合链路接口:
nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.100/24
添加网卡到bond接口(主备模式)
第一块网卡: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 /proc/net/bonding/bond0
第二个窗口:
ping 172.25.254.100
第三个窗口:
ifconfig eth0 down
2、team链路聚合
1、设定
清理所有网卡
nmcli connection delete
添加聚合链路接口:
nmcli connection add con-name team0 type team ifname team0 config '{"runner":{"name":"$"}}' 172.25.254.100/24
$--->the type of tead_mode
man -k team 查看所有和team相关的文件
man -5 tead.conf
添加网卡到bond接口(主备模式)
第一块网卡: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、测试
第一个窗口:
watch -n 1 teamdctl team0 state
第二个窗口:
ping 172.25.254.100
第三个窗口:
ifconfig eth0 down