2023年7月19日发(作者:)
H3C交换机链路聚合与服务器bond0负载均衡设置配置bond0上联⽹络设备也需要做捆绑,如果是冗余的bond则上联不⽤配置H3Cs5560交换机interface Bridge-Aggregation 1 port access vlan 10#创建聚合⼝,划⼊vlanint g 1/0/1 port link-aggregation group 1#聚合的两个物理⼝都加⼊集合组int g 2/0/1 port link-aggregation g 1服务器bond0配置cat ifcfg-bond0DEVICE=bond0BOOTPROTO=staticIPADDR=10.0.0.126NETMASK=255.0.0.0GATEWAY=10.0.0.1ONBOOT=yesUSERCTL=noTYPE=Ethernet配置cat ifcfg-eth0DEVICE=eth0BOOTPROTO=noneONBOOT=yesUSERCTL=noMASTER=bond0SLAVE=yes配置⽂件开机启⽤bond0vim /etc/modprobe.d/ias bond0 bondingoptions bond0 miimon=1000 mode=0命令⽅式启⽤bond0模块insmod /lib/modules/`uname -r`/kernel/drivers/net/bonding/ miimon=1000 mode=0其他配置删除模块命令rmmod /lib/modules/`uname -r`/kernel/drivers/net/bonding/ miimon=1000 mode=0license原因bond指定配置⽂件mac地址MACADDR=mac地址查看状态cat /proc/net/bonding/bond*#查看bond状态 ethtool bond0| grep -i speed #查看⽹卡速率如:Speed: 2000Mb/s display link-aggregation verbose |include /0/2 #Status状态为 ‘S’配置脚本.py#!/usr/bin/env python# -*- coding: utf-8 -*-# --------------------------------------------------#Author: Lghost#Email: admin@#Site: #Site: Mail:admin@#Date:2017-09-05 21:28:39 Last:2017-09-09 14:07:11#Description:
# --------------------------------------------------import sys,os,reip = "192.168.16.25"netmask = "255.255.254.0"gateway = "192.168.16.1"bond = "0"def warn (Text): print ">>>>>t033[1;31m%s033[0mt<<<<<" % Textdef info (Text): print ">>>>>t033[1;33m%s033[0mt<<<<<" % Text#提⽰def shell(cmd): (cmd)def shellinfo(cmd): r=(cmd) text=() () return text#shelldef file(path,method,content): f=open(path,method) (content) ()#fileif __name__ == "__main__": ethx_info = shellinfo("ip add |grep ^2|awk '{print $2}'") eth0 = (('w+d',ethx_info).group()) ethx_info = shellinfo("ip add |grep ^3|awk '{print $2}'") eth1 = (('w+d',ethx_info).group()) file('/etc/sysconfig/network-scripts/ifcfg-%s' % eth0,'w', file('/etc/sysconfig/network-scripts/ifcfg-%s' % eth0,'w', '''DEVICE=%s BOOTPROTO=none ONBOOT=yes USERCTL=no MASTER=bond0 SLAVE=yes ''' % (eth0)) file('/etc/sysconfig/network-scripts/ifcfg-%s' % eth1,'w', '''DEVICE=%s BOOTPROTO=none ONBOOT=yes USERCTL=no MASTER=bond0 SLAVE=yes ''' % (eth1)) file('/etc/sysconfig/network-scripts/ifcfg-bond0','w', '''DEVICE=bond0 BOOTPROTO=static IPADDR=%s NETMASK=%s GATEWAY=%s ONBOOT=yes USERCTL=no TYPE=Ethernet ''' % (ip,netmask,gateway)) file('/etc/modprobe.d/','w', ''' alias bond bonding options bond0 miimon=1000 mode=%s '''% (bond) info('配置⽂件修改完毕') info('本机地址:%s' % ip) warn('重启⽹卡中。。。') shell( 'service network restart')
发布者:admin,转转请注明出处:http://www.yc00.com/news/1689741455a282612.html
评论列表(0条)