centos 配置bond_CentOS下bond的配置方法

简介

这里介绍一下Centos6网卡的bond配置方法,由于CentOS6、和CentOS7配置bond的方法不太一样,所以这里单独的介绍一下Centos6bond配置的方法,当然这种方法也适用于CentOS7只不过CentOS7配置的方法要更高效,以后会再对CentOS7bond的配置方法。

一、概念

bond,就是网卡绑定啦,对于大型的机房来讲,是要有冗余机制的,bond便是一种网卡冗余机制,用来增加可靠性,防止单个网卡损坏出现的网络不通的情况,当然也可以提高可用性,让两张网卡同事进行数据传输。

二、配置方法

当然要做这个技术是需要两块以上的网卡的

bonding(网卡绑定)

/etc/sysconfig/network-scripts下

建立ifcfg-bond0文件添加一下内容

DEVICE=bond0  设备名

ONBOOT=yes 开机自启

BOOTPROTO=static 设置ip获取协议dhcp|static

IPADDR=6.6.6.6 这是IP

PREFIX=8这是子网掩码

GATEWAY=6.6.6.1 设置网关

BONDING_OPTS="miimon=100 mode=0 primary=eth0"

mode 绑定模式:

0负载均衡模式

1准备模式

3镜像模式

miimon 多长时间测试物理网卡是否联通

primary 指定主网卡

删除bond

ifconfig bond0 down

删除bond0文件

修改eth0、1文件

rmmod bonding

前导工作[root@centos6 Desktop]# mkdir ~/if.bak     建立备份文件夹

[root@centos6 Desktop]# cp /etc/sysconfig/network-scripts/ifcfg-eth* ~/if.bak/

备份网卡文件

[root@centos6 Desktop]# service NetworkManager stop

关闭NetworkManager服务

Stopping NetworkManager daemon:               [  OK  ]

[root@centos6 Desktop]# chkconfig NetworkManager off

关闭NetworkManager自启动服务

[root@centos6 Desktop]# iptables -F             清空防火墙

bond0 的操作[root@centos6 Desktop]# cd /etc/sysconfig/network-scripts/ 进入网卡配置文件存放目录

[root@centos6 network-scripts]# touch ifcfg-bond0         创建bond0文件

[root@centos6 network-scripts]# vim ifcfg-bond0           编辑bond0文件

[root@centos6 network-scripts]# cat ifcfg-bond0

DEVICE=bond0

ONBOOT=yes

BOOTPROTO=none

IPADDR=172.18.17.203

PREFIX=24

BONDING_OPTS="mode=1 miimon=100 primary=eth0"

eth0的操作[root@centos6 network-scripts]# vim ifcfg-eth0

DEVICE=eth0

SLAVE=yes

MASTER=bond0

eth1的操作[root@centos6 network-scripts]# vim ifcfg-eth1

DEVICE=eth1

SLAVE=yes

MASTER=bond0

后续操作[root@centos6 network-scripts]#service network restart

[root@centos6 network-scripts]# cat /proc/net/bonding/bond0    查看bond0状态

Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)

Primary Slave: eth0 (primary_reselect always)

Currently Active Slave: eth0

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

Slave Interface: eth0

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:0c:29:08:bd:6d

Slave queue ID: 0

Slave Interface: eth1

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:0c:29:08:bd:77

Slave queue ID: 0

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值