##############
##高级网络配置##
##############
## 网桥
网络桥接用网络桥实现共享上网主机和客户机除了利用软件外,还可以用系统自带的网络桥建立连接用双网卡的机器做主机
网络桥接配置:
vim /etc/sysconfig/network-scripts/ifcfg-enp0s25
*********
DEVICE=enp0s25
ONBOOT=yes
BOOTPROTO=none
BRIDGE=br0
NAME=enp0s25
*********
vim /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
ONBOOT=yes
BOOTPROTO=none
TYPE=Bridge
IPADDR=172.25.254.15
NETMASK=255.255.255.0
brctl show ##查看网桥
brctl addbr br0 ##添加网桥
brctl addif br0 eth0 ##添加网桥连接
ifconfig br0 172.25.254.115 netmask 255.255.255.0 ##配置网桥
brctl delif br0 ##删除网桥连接
brctl delbr br0 ##删除网桥
bond 网络
• Red Hat Enterprise Linux 允许管理员使用bonding 内核模块和称为通道绑定接口的特殊网络接口将多个网络接口绑定到一个通道。根据选择的绑定模式 , 通道绑定使两个或更多个网络接口作为一个网络接口 , 从而增加带宽和 / 提供冗余性
选择 Linux 以太网绑定模式
• 模式 0 ( 平衡轮循 ) - 轮循策略 , 所有接口都使用采用轮循方式在所有 Slave 中传输封包 ; 任何
Slave 都可以接收
• 模式 1 ( 主动备份 ) - 容错。一次只能使用一个Slave 接口 , 但是如果该接口出现故障 , 另一个
Slave 将 接替它
• 模式 3 ( 广播 ) - 容错。所有封包都通过所有Slave 接口广播
watch -n 1 cat /proc/net/bonding/bond0 ##监控bond0
nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.115 ##建立绑定接口bond0
nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0 ##建立 slave接口eth0
nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0 ##建立slave接口eth1
ifconfig eth0 down ##关闭eth0
ifconfig eth0 up ##开启eth0
nmcli connection delete eth0 ##删除
nmcli connection delete eth1 ##删除
nmcli connection delete bond0 ##删除
Team 接口
• Team 和 bond0 功能类似
• Team 不需要手动加载相应内核模块
• Team 有更强的拓展性
– 支持 8 快网卡
Team 的种类
•broadcast 广播容错
•roundrobin 轮询
•activebackup 主备
•loadbalance 负载均衡
watch -n 1 teamdctl team0 stat ##监控team0
nmcli connection add con-name team0 ifname team0 type team config '{"runner":{"name":"activebackup"}}' ip4 172.25.254.115/24 ##建立
nmcli connection add con-name eth0 type team-slave ifname eth0 master team0 ##添加
nmcli connection add con-name eth1 type team-slave ifname eth1 master team0