银河麒麟操作系统上配置Bond(二)使用ifenslave方式
2017-08-02 11:49
579 查看
银河麒麟操作系统上使用ifenslave配置Bond
ifenslave是一款Linux下的负载均衡工具,银河麒麟操作系统也支持该工具。
一、安装ifenslave
$ sudo apt-get install ifenslave
二、配置bonding
在/etc/modules 文件末添加一行内容:bonding,设置 bonding 模块开机自动加载;
$ sudo vim /etc/modules
修改后的modules文件如下:
# /etc/modules: kernel modules toload at boot time.
#
# This file contains the names ofkernel modules that should be loaded
# at boot time, one per line. Linesbeginning with "#" are ignored.
bonding
2. 执行ifconfig -a查看系统所有网口,选择两个接口做bonding,比如enp1s0f1、enp1s0f2
3. 创建/etc/modprobe.d/bonding.conf文件,内容如下:
options bonding mode=1 miimon=100
其中mode=1,表示是 (active-backup)Active-backup policy:(主-备份策略):只有一个设备处于活动状态。一个宕掉另一个马上由备份转换为主设备。mac地址是外部可见的。此模式提供了容错能力。 miimon是毫秒数,每100毫秒触发检测线路稳定性的事件。 4. 加载bonding模块。执行
$ sudo modprobebonding查看模块是否加载成功:$ lsmod| grepbonding 5. 配置链路聚合名为bond0,聚合后使用的IP地址为192.168.100.155和16位掩码:
$ sudo ifconfigbond0 192.168.100.155 netmask 255.255.0. 6. 配置bond0使用的网络接口
$ sudo ifenslavebond0 enp1s0f1 enp1s0f2 7. 为了 bond0 开机重启后可以继续使用,写入配置文件
$ sudo vim/etc/network/interfaces添加bond0相应的配置,autobond0及以后为新添加的内容,修改完成后的文件内容为:# interfaces(5)file used by ifup(8) and ifdown(8)auto loiface lo inetloopback auto bond0iface bond0 inetstaticaddress192.168.100.155netmask255.255.0.0gateway192.168.1.254dns-nameservers192.168.0.53post-upifenslave bond0 enp1s0f1 enp1s0f2pre-downifenslave -d bond0 enp1s0f1 enp1s0f2配置完成后,重启服务器。 8. 重新启动reboot服务器后,测试拔出任何一个接口的网线,ping其他网络不会中断。
--------------------------
银河麒麟操作系统是天津麒麟信息技术有限公司自主研发的类Linux操作系统,目前有桌面版和服务器版以及一些特种行业的定制版本。银河麒麟社区版可在http://www.ubuntukylin.com/downloads/自由下载使用。
ifenslave是一款Linux下的负载均衡工具,银河麒麟操作系统也支持该工具。
一、安装ifenslave
$ sudo apt-get install ifenslave
二、配置bonding
在/etc/modules 文件末添加一行内容:bonding,设置 bonding 模块开机自动加载;
$ sudo vim /etc/modules
修改后的modules文件如下:
# /etc/modules: kernel modules toload at boot time.
#
# This file contains the names ofkernel modules that should be loaded
# at boot time, one per line. Linesbeginning with "#" are ignored.
bonding
2. 执行ifconfig -a查看系统所有网口,选择两个接口做bonding,比如enp1s0f1、enp1s0f2
3. 创建/etc/modprobe.d/bonding.conf文件,内容如下:
options bonding mode=1 miimon=100
其中mode=1,表示是 (active-backup)Active-backup policy:(主-备份策略):只有一个设备处于活动状态。一个宕掉另一个马上由备份转换为主设备。mac地址是外部可见的。此模式提供了容错能力。 miimon是毫秒数,每100毫秒触发检测线路稳定性的事件。 4. 加载bonding模块。执行
$ sudo modprobebonding查看模块是否加载成功:$ lsmod| grepbonding 5. 配置链路聚合名为bond0,聚合后使用的IP地址为192.168.100.155和16位掩码:
$ sudo ifconfigbond0 192.168.100.155 netmask 255.255.0. 6. 配置bond0使用的网络接口
$ sudo ifenslavebond0 enp1s0f1 enp1s0f2 7. 为了 bond0 开机重启后可以继续使用,写入配置文件
$ sudo vim/etc/network/interfaces添加bond0相应的配置,autobond0及以后为新添加的内容,修改完成后的文件内容为:# interfaces(5)file used by ifup(8) and ifdown(8)auto loiface lo inetloopback auto bond0iface bond0 inetstaticaddress192.168.100.155netmask255.255.0.0gateway192.168.1.254dns-nameservers192.168.0.53post-upifenslave bond0 enp1s0f1 enp1s0f2pre-downifenslave -d bond0 enp1s0f1 enp1s0f2配置完成后,重启服务器。 8. 重新启动reboot服务器后,测试拔出任何一个接口的网线,ping其他网络不会中断。
--------------------------
银河麒麟操作系统是天津麒麟信息技术有限公司自主研发的类Linux操作系统,目前有桌面版和服务器版以及一些特种行业的定制版本。银河麒麟社区版可在http://www.ubuntukylin.com/downloads/自由下载使用。
相关文章推荐
- 银河麒麟操作系统上配置Bond(一)利用nmcli
- Castle ActiveRecord 使用 Web.config 配置数据库连接方式
- Video : 将使用AD认证的SharePoint网站配置为表单方式登录
- 使用缓存配置文件以声明方式设置页的可缓存性
- IIS7 上配置 FTP7 使用 IIS管理凭据 方式进行验证 推荐
- 使用rman nocatalog方式备份Oracle - NetBackup配置方法
- 使用links方式配置eclipse
- 配置使用web方式修改域用户帐户密码
- windows server 2008下使用fastcgi方式配置php环境的惨痛经历
- 读取配置文件[方式二]之使用Awk实现
- 使用links方式配置Eclipse插件
- 使用links方式配置Eclipse插件
- [EntLib]微软企业库5.0 学习之路——第八步、使用Configuration Setting模块等多种方式分类管理企业库配置信息
- 配置使用web方式修改域用户帐户密码
- AR系列路由器使用SSH用户验证方式为password登录路由器的典型配置
- WCF步步为营(三):使用配置文件改变使用服务的方式
- jboss 使用IP访问的配置方式(包括eclipse配置)
- Castle ActiveRecord 使用动态填写参数方式配置数据库连接
- 代理自动配置文件-pac文件格式以及使用方式
- 使用序列化的方式来读取XML配置文件