linux网卡绑定与多vlan实现
1.先停止network service:
#service network stop
2.建立bound0 虚拟接口
#cd /etc/sysconfig/network-scripts
#touch ifcfg-bound0
#vi ifcfg-bond0
DEVICE=bond0
BOOTPROTO=static
ONBOOT=yes
USERCTL=no
TYPE=Ethernet
3.设定bound0 的slave接口
#vi ifcfg-eth0
DEVICE=eth0 www.zhishiwu.com
BOOTPROTO=static
ONBOOT=yes
HOTPLUG=no
MASTER=bond0
SLAVE=yes
#vi ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
ONBOOT=yes
HOTPLUG=no
MASTER=bond0
SLAVE=yes
#vi ifcfg-eth2
DEVICE=eth2
BOOTPROTO=static
ONBOOT=yes
HOTPLUG=no
MASTER=bond0
SLAVE=yes
#vi ifcfg-eth3
DEVICE=eth3
BOOTPROTO=static
ONBOOT=yes
HOTPLUG=no
MASTER=bond0
SLAVE=yes
4.设定bound0 的slave接口
# vim /etc/ modprobe.conf
alias eth0 bnx2
alias eth1 bnx2
alias eth2 bnx2
alias eth3 bnx2
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptsas
alias scsi_hostadapter2 megaraid_sas
alias scsi_hostadapter3 ata_piix
alias usb0 cdc_ether
install bond0 /sbin/modprobe bonding -o bond0 miimon=100 mode=4 #-----mode=4 是标准的802.3ad www.zhishiwu.com
# Begin Dell MD Modification
options scsi_dh_rdac blacklist="DELL:MD3000,DELL:MD3000i"
# End Dell MD Modification
alias pcspkr off
5.加载bound0
#modprob bound0
6.建立vlan
建立vlan2
#cd /etc/sysconfig/network-scripts
#touch ifcfg-bound0.2 #----表示建立vlan2
#vi ifcfg-bond0.2
DEVICE=bond0.2
BOOTPROTO=static
ONBOOT=yes
USERCTL=no
VLAN=yes
IPADDR=2.2.2.2
NETMASK=255.255.255.0
建立vlan3
#cd /etc/sysconfig/network-scripts
#touch ifcfg-bound0.3 #----表示建立vlan2
#vi ifcfg-bond0.3
DEVICE=bond0.3
BOOTPROTO=static
ONBOOT=yes www.zhishiwu.com
USERCTL=no
VLAN=yes
IPADDR=3.3.3.3
NETMASK=255.255.255.0
7.将加载bond 选项加入到开机选项中
[root@MCDBKP01 network-scripts]# more /etc/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.
modprobe bonding 加载bonding 模块
service network restart
保存退出
8.重启网络服务
在/etc/sysconfig/network 中添加default gateway
GATEWAY =X.X.X.X www.zhishiwu.com
#/etc/init.d/network restart
到此server 上配置结束了
ifconifg 看到 所有vlan的IP了
route 可以看到所有的路由
交换机配置:
交换机 邦定向对应端口 使用标准802.3ad 协议 静态绑定
active Enable initiation of LACP negotiation on a port
on Enable static link aggregation on this port
passive Disable initiation of LACP negotiation on a port