服务器网卡多网卡绑定及vlan支持

服务器网卡多网卡绑定及vlan支持

 

版本: 1.2 2014-12-04 增加一个排错案例 

版本: 1.1 2012-07-26 增加如何查看linux系统中的bond状态

版本: 1.0

原理: 利用802.3ad协议,实现多网卡的绑定。

利用802.31p协议,实现服务器对多vlan的支持。

结果: 通过netperf测试,双网卡绑定流量可以达到1.5G以上。

通过对vlan的支持,服务器可以绑定多个vlan的ip。

clip_image002[4]

软件环境:

broadcom网卡 windows 2003 windows 2008 Dotnet3.5 broadcom 管理软件BACS

intel 网卡 windows 2003 windows 2008 最新驱动包

hp服务器 最新驱动包,hp网卡管理工具

linux centos 6.2

注意事项:

1) 一定要确定交换机端口和服务器网卡的对应关系。

2) 配置的时候,交换机端口关闭,待服务器和交换机全部完成配置后,再开启端口,否则可能导致交换机端口自动阻塞。

3) 配置的时候网卡ip信息会丢失,如果是远程操作,会造成连接丢失,请做预案。

 

操作步骤:

1. 交换机配置

多网卡绑定支持

假设3,4端口做port-channel,相关配置如下:

snda-intel-lab-2960s-250#sh running-config int port-channel 1

Building configuration...

 

Current configuration : 55 bytes

!

interface Port-channel1

switchport mode access

end

 

 

snda-intel-lab-2960s-250#sh running-config int g0/3

Building configuration...

 

Current configuration : 137 bytes

!

interface GigabitEthernet0/3

switchport mode access

spanning-tree portfast

channel-protocol lacp

channel-group 1 mode passive

end

 

snda-intel-lab-2960s-250#sh running-config int g0/4

Building configuration...

 

Current configuration : 137 bytes

!

interface GigabitEthernet0/4

switchport mode access

spanning-tree portfast

channel-protocol lacp

channel-group 1 mode passive

end

 

vlan支持,交换机接服务器端口做truak配置

 

interface GigabitEthernet0/15

switchport mode trunk

 

2. 软件安装

Windows 系统

1) intel网卡在intel网站下载最新的网卡驱动安装就可以。

2) broadcom 网卡在broadcom网站下载最新驱动,并下载网卡管理工具,目前能下载到的管理工具只支持windows server 2008,如果需要支持windows server 2003 请在dell ibm 等厂家网站支持页面下载比较老的版本。

3) hp服务器安装最新的网卡驱动和管理工具,hp的设置方法和broadcom设置类似,多网卡绑定介绍broadcom管理工具使用,网卡vlan介绍hp网卡的使用。

Linux 系统不需要安装特殊软件

3. 配置网卡端口绑定

Windows 系统

broadcom网卡

添加一个端口组

clip_image004[4]

下一步

clip_image006[4]

输入一个名字

clip_image008[4]

选择第二项802.3ad

clip_image010[4]

添加要绑定的网卡

clip_image012[4]

配置vlan,一般没有的,跳过

clip_image014[4]

完成

clip_image016[4]

需要几分钟的配置

clip_image018[4]

网卡需要几分钟和交换机协商,完成后,可以看到两块网卡开始正常工作

clip_image020[4]

intel 网卡

选择网卡属性

clip_image022[4]

选择分组—将此适配器与其他适配器组合—新组

clip_image024[4]

clip_image026[4]

选择网卡

clip_image028[4]

clip_image030[4]

clip_image032[4]

clip_image034[4]

创建成功,将Ip绑定到新建的组上。

Linux 系统

[root@lab]# cat /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0

BOOTPROTO=none

IPADDR=172.16.1.248

NETMASK=255.255.255.0

GATEWAY=172.16.1.1

TYPE=Ethernet

BONDING_OPTS="mode=4 miimon=100"

[root@lab]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=none

ONBOOT=yes

TYPE=Ethernet

MASTER=bond0

SLAVE=yes

[root@lab]# cat /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

ONBOOT=yes

BOOTPROTO=none

TYPE=Ethernet

MASTER=bond0

SLAVE=yes

[root@lab]# cat /etc/modprobe.d/bond0.conf

alias bond0 bonding

4. 配置网卡对vlan的支持

Windows 系统

Intel网卡

选择网络连接属性---网卡配置

clip_image036[6]

点击vlan按钮

clip_image038[4]

新建一个vlan,输入vlan id名字---确定

clip_image040[4]

过一会就可以在网络管理器看到两个网卡,

clip_image042[4]

如果需要创建多个vlan,可以同样设置。

Broadcom网卡

以hp服务器为例,dell ibm使用broadcom的管理工具,配置过程类似

选择需要配置vlan的网卡,点击vlan按钮

clip_image044[4]

添加一个vlan100

clip_image046[4]

clip_image048[4]

等待配置生效

clip_image050[4]

完成后可以看到生成一个网卡,vlan100,如果需要生成多个vlan,可以重复操作:

clip_image052[4]

Linux 系统

配置对vlan100的支持

[root@lab]# cat ifcfg-eth1

DEVICE=eth1

HWADDR=E4:1F:13:B7:8F:56

ONBOOT=yes

BOOTPROTO=none

TYPE=Ethernet

[root@lab]# cat ifcfg-eth1.100

DEVICE=eth1.100

ONBOOT=yes

BOOTPROTO=none

TYPE=Ethernet

VLAN=yes

IPADDR=*.*.*.*

NETMASK=255.255.255.0

附1

Linux 系统中参数及其意义

mode=<value>

Allows you to specify the bonding policy. The <value> can be one of:

balance-rr or 0 &mdash; Sets a round-robin policy for fault tolerance and load balancing. Transmissions are received and sent out sequentially on each bonded slave interface beginning with the first one available.

active-backup or 1 &mdash; Sets an active-backup policy for fault tolerance. Transmissions are received and sent out via the first available bonded slave interface. Another bonded slave interface is only used if the active bonded slave interface fails.

balance-xor or 2 &mdash; Sets an XOR (exclusive-or) policy for fault tolerance and load balancing. Using this method, the interface matches up the incoming request's MAC address with the MAC address for one of the slave NICs. Once this link is established, transmissions are sent out sequentially beginning with the first available interface.

broadcast or 3 &mdash; Sets a broadcast policy for fault tolerance. All transmissions are sent on all slave interfaces.

802.3ad or 4 &mdash; Sets an IEEE 802.3ad dynamic link aggregation policy. Creates aggregation groups that share the same speed and duplex settings. Transmits and receives on all slaves in the active aggregator. Requires a switch that is 802.3ad compliant.

balance-tlb or 5 &mdash; Sets a Transmit Load Balancing (TLB) policy for fault tolerance and load balancing. The outgoing traffic is distributed according to the current load on each slave interface. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed slave.

balance-alb or 6 &mdash; Sets an Active Load Balancing (ALB) policy for fault tolerance and load balancing. Includes transmit and receive load balancing for IPV4 traffic. Receive load balancing is achieved through ARP negotiation.

附2:

Linux 系统中绑定失败的处理一例

insmod /lib/modules/2.6.18-164.el5/kernel/net/ipv6/ipv6.ko disable=1

insmod /lib/modules/2.6.18-164.el5/kernel/drivers/net/bonding/bonding.ko

 

3:

查看linux系统中bond状态

 

cat /proc/net/bonding/bond0 

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

 

Bonding Mode: load balancing (round-robin)

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

 

Slave Interface: eth1

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:1b:21:9f:0e:17

Slave queue ID: 0

 

Slave Interface: eth3

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:1b:21:9f:0c:37

Slave queue ID: 0

 

Slave Interface: eth5

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:25:90:14:1a:19

Slave queue ID: 0


附4

最近在实施一个网卡绑定的时候,碰到一个很奇怪的案例。

现象是:

eth0 eth1 绑定成bond0,使用的是mode4,交换机对应的端口也做了绑定。

测试的时候发现一个很奇怪的现象,将eth1 down up网络可以正常通讯。

将eth0 down 网络可以正常通讯 但是将eth0 up的时候,网络直接就会断掉。

查看bond状态,bond得不到mac,端口只有一个。

cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)
Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
802.3ad info
LACP rate: fast
Aggregator selection policy (ad_select): stable
Active Aggregator Info:
        Aggregator ID: 15
        Number of ports: 1
        Actor Key: 17
        Partner Key: 3
        Partner Mac Address: 000000000


h3c交换机修改成和服务器动态协商

link-aggregation mode dynamic

 

 

你可能感兴趣的:(绑定,网卡,VLAN)