SUSE_linux做bond

创建bond0配置文件
可以用网卡配置文件修改

gsc:/etc/sysconfig/network # cp ifcfg-eth0 ifcfg-bond0 
gsc:/etc/sysconfig/network # vi ifcfg-bond0 

BOOTPROTO='static'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='192.168.1.101'
MTU=''
NAME=''
NETMASK='255.255.255.0'
NETWORK='192.168.1.0'
REMOTE_IPADDR=''
STARTMODE='auto'
BONDING_MASTER='yes'
BONDING_SLAVE0='eth0'
BONDING_SLAVE1='eth1'
BONDING_MODULE_OPTS='mode=1 miimon=100 fail_over_mac=1'
REMOTE_IPADDR=''
USERCONTROL='no'
TYPE=bond

fail_over_mac=1 这个参数是在VMware中测试用的,正常不用写
                    

网卡配置文件:

gsc:/etc/sysconfig/network # vi ifcfg-eth0 

DEVICE='eth0'
BOOTPROTO='none'
ONBOOT='yes'
NETMASK='bond0'
SLAVE='yes'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR=''
MTU=''
NAME='82576 Gigabit Network Connection'
TYPE'Ethernet'
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
USERCTL='no'
PREFIXLEN='32'
USERCONTROL='no'




gsc:/etc/sysconfig/network # vi ifcfg-eth1

DEVICE='eth1'
BOOTPROTO='none'      这里一定要写none
ONBOOT='yes'
NETMASK='bond0'
SLAVE='yes'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR=''
MTU=''
NAME='82576 Gigabit Network Connection'
TYPE'Ethernet'
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
USERCTL='no'
PREFIXLEN='32'
USERCONTROL='no'

开机加载bonding驱动
或者写modprobe.conf

gsc:/etc/sysconfig/network # vi /etc/modprobe.d/bonding.conf 
alias bond0 bonding


gsc:/etc/sysconfig/network # modprobe bonding
加载模块

gsc:/etc/sysconfig/network # lsmod | grep bonding 
bonding               147456  0 

重启网络

gsc:/etc/sysconfig/network # service network restart 

检查状态:

gsc:/etc/sysconfig/network # ip a 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
    link/ether 00:0c:29:c8:4d:d7 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
    link/ether 00:0c:29:c8:4d:e1 brd ff:ff:ff:ff:ff:ff
5: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:0c:29:c8:4d:d7 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.101/24 brd 192.168.1.255 scope global bond0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fec8:4dd7/64 scope link 
       valid_lft forever preferred_lft forever
gsc:/etc/sysconfig/network # 
gsc:/etc/sysconfig/network # ethtool eth0 
gsc:/etc/sysconfig/network # ethtool eth1 
gsc:/etc/sysconfig/network # ethtool -i eth0 
gsc:/etc/sysconfig/network # ethtool -i eth1 

gsc:/etc/sysconfig/network # cat /proc/net/bonding/bond0

简易配置:

 vi /etc/sysconfig/network/ifcfg-bond0
     
      BOOTPROTO='static'
      STARTMODE='onboot'
      IPADDR='192.168.1.1'
      NETMASK='255.255.255.0'
      DEVICE='bond0'
      BONDING_MASTER='yes'
      BONDING_MODULE_OPTS='mode=1 miimon=100 use_carrier=1' # "mode=1"表示主备绑定,"mode=0"表示负载均衡,需要交换机侧配置eth-turnk
      BONDING_SLAVE0='eth2'
      BONDING_SLAVE1='eth3 
vi /etc/sysconfig/network/ifcfg-eth2

      BOOTPROTO='none'
      STARTMODE='onboot'
vi /etc/sysconfig/network/ifcfg-eth3

      BOOTPROTO='none'
      STARTMODE='onboot'
rcnetwork restart    重启网络服务
cat /proc/net/bonding/bond0   查看bond状态
ifenslave -c bond0 eth3    手动主备切换
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值