linux网卡绑定划vlan,linux 网卡绑定与多vlan实现

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

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.设定bond0 的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 bond0

6.建立vlan

建立vlan2

#cd /etc/sysconfig/network-scripts

#touch ifcfg-bond0.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 可以看到所有的路由

察看bond0 的模式

more /sys/class/net/bond0/bonding/mode

echo 0 > /sys/class/net/bond0/bonding/mode

交换机配置:

交换机 邦定向对应端口 使用标准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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值