bond配置实战

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了bond配置实战相关的知识,希望对你有一定的参考价值。

1.[[email protected] network-scripts]# ls   查看网卡类型

ifcfg-bond0  ifdown       ifdown-ppp     ifup-eth    ifup-ppp          network-functions

ifcfg-eth0   ifdown-bnep  ifdown-routes  ifup-ippp   ifup-routes       network-functions-ipv6

ifcfg-eth1   ifdown-eth   ifdown-sit     ifup-ipv6   ifup-sit

ifcfg-eth2   ifdown-ippp  ifdown-tunnel  ifup-isdn   ifup-tunnel

ifcfg-eth3   ifdown-ipv6  ifup           ifup-plip   ifup-wireless

ifcfg-lo     ifdown-isdn  ifup-aliases   ifup-plusb  init.ipv6-global

ifcfg-usb0   ifdown-post  ifup-bnep      ifup-post   net.hotplug


2.查看bond接口配置

(1)[[email protected] network-scripts]# cat ifcfg-bond0 

DEVICE=bond0

ONBOOT=yes

TYPE=Ethernet

BOOTPROTO=static

IPADDR=192.168.40.40

NETWORK=192.168.40.0

NETMASK=255.255.255.0

BROADCAST=192.168.40.255

GATEWAY=192.168.40.254

USERCTL=NO

(2)[[email protected] network-scripts]# cat ifcfg-eth2

DEVICE=eth2

HWADDR=90:E2:BA:73:49:52

TYPE=Ethernet

UUID=7431769c-f1d9-41bc-8e8a-fa702a355296

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

USERCTL=no

(3)[[email protected] network-scripts]# cat ifcfg-eth3

DEVICE=eth3

HWADDR=90:E2:BA:73:49:53

TYPE=Ethernet

UUID=496784dc-b5f5-4b50-8cb8-72eec3fdea3c

ONBOOT=yes

NM_CONTROLLED=yes

MASTER=bond0

SLAVE=yes

BOOTPROTO=none

IPV6INIT=no

USERCTL=no

[[email protected] network-scripts]# 


3.设置bond模式

[[email protected] network-scripts]# cat /etc/modprobe.d/bonding.conf 

alias eth2 pcnet32

alias scsi_hostadapter mptbase

alias scsi_hostadapter1 mptscsih

alias eth3 pcnet32

alias bond0 bonding

options bond0 miimon=100 mode=1

[[email protected] network-scripts]# 


4.设置开机启动接口

[[email protected] network-scripts]# cat /etc/rc.d/rc.local 

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don‘t

# want to do the full Sys V style init stuff.


touch /var/lock/subsys/local

route add -net 192.168.10.0/24 gw 192.168.10.254 dev eth0

route add -net 192.168.20.0/24 gw 192.168.20.254 dev eth1

route add -net 192.168.1.0/24 gw 192.168.10.254 

route add -net 0.0.0.0/0 gw 192.168.20.254 metric 20

ifenslave bond0 eth2 eth3 

[[email protected] network-scripts]# 


5.查询bond状态

[[email protected] network-scripts]# cat /proc/net/bonding/bond0 

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)


Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: eth2

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0


Slave Interface: eth2

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 1

Permanent HW addr: 90:e2:ba:73:49:52

Slave queue ID: 0


Slave Interface: eth3

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 1

Permanent HW addr: 90:e2:ba:73:49:53

Slave queue ID: 0

[[email protected] network-scripts]# 


本文出自 “山猫” 博客,请务必保留此出处http://cqtangbo.blog.51cto.com/2978612/1752283

以上是关于bond配置实战的主要内容,如果未能解决你的问题,请参考以下文章

centos6.x 配置bond

Linux系统之Bonding 网卡绑定配置方法

centos7.x网卡bond配置

HP C7000刀片服务器实战6:redhat6.8网卡绑定

CentOS下bond的配置方法

linux下网卡bonding配置