interface Bridge-Aggregation 1
port access vlan 10
#创建聚合口,划入vlan
int g 1/0/1
port link-aggregation group 1
#聚合的两个物理口都加入集合组
int g 2/0/1
port link-aggregation g 1
bond0配置cat ifcfg-bond0
DEVICE=bond0
BOOTPROTO=static
IPADDR=10.0.0.126
NETMASK=255.0.0.0
GATEWAY=10.0.0.1
ONBOOT=yes
USERCTL=no
TYPE=Ethernet
eth1,2...配置cat ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes
vim /etc/modprobe.d/openfwwf.conf
alias bond0 bonding
options bond0 miimon=1000 mode=0
insmod /lib/modules/`uname -r`/kernel/drivers/net/bonding/bonding.ko miimon=1000 mode=0
rmmod /lib/modules/`uname -r`/kernel/drivers/net/bonding/bonding.ko miimon=1000 mode=0
MACADDR=mac地址
cat /proc/net/bonding/bond*
ethtool bond0| grep -i speed
display link-aggregation verbose | include /0/2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# --------------------------------------------------
#Author: Lghost
#Email: admin@attacker.club
#Site: attacker.club
# --------------------------------------------------
import sys,os,re
ip = "192.168.16.25"
netmask = "255.255.254.0"
gateway = "192.168.16.1"
bond = "0"
def warn (Text):
print ">>>>>\t\033[1;31m%s\033[0m\t<<<<<" % Text
def info (Text):
print ">>>>>\t\033[1;33m%s\033[0m\t<<<<<" % Text
#提示
def shell(cmd):
os.system(cmd)
def shellinfo(cmd):
r=os.popen(cmd)
text=r.read()
r.close()
return text
#shell
def file(path,method,content):
f=open(path,method)
f.write(content)
f.close()
#file
if __name__ == "__main__":
ethx_info = shellinfo("ip add |grep ^2|awk '{print $2}'")
eth0 = (re.match('\w+\d',ethx_info).group())
ethx_info = shellinfo("ip add |grep ^3|awk '{print $2}'")
eth1 = (re.match('\w+\d',ethx_info).group())
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/bond.conf','w',
'''
alias bond bonding
options bond0 miimon=1000 mode=%s
'''% (bond)
info('配置文件修改完毕')
info('本机地址:%s' % ip)
warn('重启网卡中。。。')
shell( 'service network restart')