交换机和服务器连接做(链路聚合+bond0 )教程
交换机和服务器连接一般采用双网线,也就是两根网线,做了bond 速度会提高,而且一根线坏了另一根会自动切换
一、交换机端配置
交换机链路聚合分: 手工负载分担模式 | LACP模式 两种
1、华为交换机配置(手工模式)
sy interface Eth-Trunk 1 trunkport GigabitEthernet 0/0/1 to 0/0/2 port link-type trunk port trunk allow-pass vlan all
2、华三交换机配置(手工模式)
sy interface bridge-aggregation 1 quit int g1/0/1 port link-aggregation group 1 quit int g1/0/2 port link-aggregation group 1 quit interface bridge-aggregation 1 port link-type access port default vlan 2
二、服务器端配置
1、Windows服务器配置(Windows server 2016 )
1、打开服务器管理器 2、点击NIC组合 已禁用 点击启用它 3、在NIC组合对话框里选择任务然后新建组,组名bond0 然后勾选两块网卡,选择交换机独立模式 4、在网卡里找到bond0新生成的,设置ip地址即可。
2、Linux服务器配置
双网卡绑定bond 有7种模式 mode表示工作模式
0 表示负载均衡,两块网卡同时工作,速度快
1 表示主备,一块工作,一块备份
2 提供负载均衡和主备
3 提供容错性
4 提供ethtool的迅速,使用802.3ad模式
5 自动适应负载均衡,自动切换故障,
6 在5模式优化了arp广播
1、修改第一块网卡 vi /etc/sysconfig/network-scripts/ifcfg-ens160 ONBOOT=yes BOOTPROTO=none MASTER=bond0 SLAVE=yes 2、修改第二块网卡 vi /etc/sysconfig/network-scripts/ifcfg-ens161 ONBOOT=yes BOOTPROTO=none MASTER=bond0 SLAVE=yes 3、创建bond0网卡如果需要上网就配置DNS,企业一般不上网 vi /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 BOOTPROTO=static ONBOOT=yes TYPE=Ethernet IPADDR=192.168.0.10 #IP地址 NETMASK=255.255.255.0 #子网掩码 GATEWAY=192.168.0.254 #网关 4、修改/etc/modprobe.d/dist.conf 绑定模型修改 alias bond0 bonding options bond0 miimon=100 mode=0 5、修改 /etc/rc.local 负责系统启动将虚拟网卡和物理网卡绑定 ifenslave bond0 ens160 ens161 6、重启网卡 service network restart 如果redhat8 用 nmcli connection reload ens160 注意:如果centos6 版本需要关闭 service NetworkManager stop 未关闭重启出现网络不可用。 chkconfig NetworkManager off 这是永久关闭
注意
0模式交换机要配手工负载分担模式
1模式交换机不需要配置链路聚合
2 不需要交换机配置
3 不需要交换机配置
4 需要交换机配置LACP
5 不需要交换机配置
6 需要交换机做链路聚合
- 海报