歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> linux網卡綁定與多vlan實現

linux網卡綁定與多vlan實現

日期:2017/2/27 16:04:38   编辑:Linux教程

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
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
# 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
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
#/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
Copyright © Linux教程網 All Rights Reserved