AIX 做网卡聚合绑定

|||||||||||||||||||||||||||||||||
在AIX 5L上使用绑定网卡(etherchannel)
在AIX操作系统中,用户可以配置多个EtherChannel(网卡绑定)。在AIX 5.2之前,我们要么只能选择active/active EtherChannel模式,要么,只能选择active/standby EtherChannel模式的绑定网卡。所以,AIX 5.2中引入了新的网卡后备模式,用户可以为整个EtherChannel指定一块备份网卡,当整个EtherChannel失效时,这块网卡会自动顶替EtherChannel的功能。这与AIX 5.2之前的EtherChannel网卡备份模式有很大区别,因此,在5.2以后可以出现更为复杂的复合网卡绑定模式。
 

一个EtherChannel中可以有2到8块网卡,一个AIX操作系统中可以配置多个EtherChannel。但要记住每个EtherChannel都是一个新的以太网接口,用户也许需要通过no命令调整ifsize参数的值来保证以太网卡和EtherChannel的总数不超过ifsize,ifsize的默认值是8。

您可以使用任何AIX系统支持的网卡来组建EtherChannel。但EtherChannel的同一个通道成员网卡必须连接到支持EtherChannel的交换机上,备用通道可以接入到另外一个交换机,用于主通道的失败接管。EtherChannel的所有成员网卡都应该设置成同样的速度和工作模式,如1000兆全双工。要用作EtherChannel成员的网卡不能配置IP地址,如果已经配置了,必须要在开始配置EtherChannel前删除这些配置。

 

在Aix5.2以后,我们看看三种典型的配置方式

1、双通道或者多通道的共同active模式,这个模式下,所有的网卡都处于active状态,也就是每个网卡都处于工作状态,他们共有一个IP地址与MAC地址,但是,所有网卡的目标必须在同一个交换机上,并且交换机的对应端口也要绑定。

这样做最大的好处就是,当其中一个网卡失效,或者一根网线失效的时候,不影响整个网络的工作,只有当所有的网卡通道失效的时候,网络才失效。而且,多个网卡的同时工作,可以增加网络带宽,不过,要注意,默认的分配方式是根据目标机器的Ip来分配使用哪个网卡,如果目标机器只有一台,不适合使用默认设置。这种模式下,最大的问题就是所有的网卡目标必须在同一个交换机上,并且绑定在一起,不能防止目标交换机故障。

2、active/standby模式,这样的模式下,一个网卡接到主交换机,一个网卡接到备用交换机,当active通道失效的时候,自动切换到standby通道,当主通道恢复正常的时候,再自动切换到主通道(这里是否切换回去,是可以配置的)。这种方式最大的好处就是可以防止交换机的故障。

3、复合式配置,在这种配置中,结合以上2种方式的优点。如一个3块网卡的环境中,我们可以把其中2片网卡配置成双active模式,以增加网络带宽以及网络的可靠性,另外一块网卡作为后备模式,接在另外一个交换机上,当前面2个网卡都失效,或者前面2个网卡接的交换机失效的时候,切换到后备网卡上。如图:

 

 

下面,我们介绍一下详细的步骤:

如果想绑定或者取消绑定,可以用smit etherchannel完成,如要绑定ent1与ent2则:。

#chdev -l en1 -a netaddr=” -a netmask=”

#chdev -l en2 -a netaddr=” -a netmask=”

#chdev -l en1 -a state=’detach’

#chdev -l en2 -a state=’detach’

注意:以上命令是必要的,子网卡先取消现有的IP地址,以及一定要处于detach状态,注意,如果通过en1或者en2连接到主机,操作以上的命令,你的网络可能马上就被中断了,所以,以上的操作建议通过其它网卡完成,或者在HMC上完成。然后,我们开始绑定

#smit etherchannel

选择

Add An EtherChannel / Link Aggregation

在这里选择网卡

EtherChannel / Link Aggregation Adapters ent1,ent2

回车执行:

    Command: OK            stdout: yes           stderr: no
    Before command completion, additional instructions may appear below.
    ent4 Available

最后会提示新的网卡的生成,这个网卡就是可用的绑定过之后的网卡。可用lsattr查看其属性或者是lsdev -Cc adapter看所有网卡属性。
#lsattr -El ent4

    adapter_names   ent1,ent2      EtherChannel Adapters                     True
    alt_addr        0x000000000000 Alternate EtherChannel Address            True
    auto_recovery   yes            Enable automatic recovery after failover  True
    backup_adapter  NONE           Adapter used when whole channel fails     True
    hash_mode       default        Determines how outgoing adapter is chosen True
    mode            standard       EtherChannel mode of operation            True
    netaddr                        Address to ping                           True
    num_retries     3              Times to retry ping before failing        True
    retry_time      1              Wait time (in seconds) between pings      True
    use_alt_addr    no             Enable Alternate EtherChannel Address     True
    use_jumbo_frame no             Enable Gigabit Ethernet Jumbo Frames      True

这样绑定的网卡是双通路的,就是说两个网卡都是处于活动状态,注意,这里还需要交换机配合才可以最终接通2块网卡,网络交换机的设置,可以联系你们的系统管理员。

我们也可以设置备用网卡,平常并不活动,处于备用接管状态,如果主通道发生问题,则切换到备用通道,这样的话,则可以接到两个不同的交换机上用于交换机冗余。

备用网卡就是上面的backup_adapter,可以通过

#smit chgethch

或者是

#smit etherchannel

选择

Change / Show Characteristics of an EtherChannel / Link Aggregation

再选择

Add Backup Adapter来完成。增加过后备网卡的绑定网卡,对比以上,将有如下的差别:

#lsattr -El ent4

    adapter_names   ent1,ent2      EtherChannel Adapters                     True
    alt_addr        0x000000000000 Alternate EtherChannel Address            True
    auto_recovery   yes            Enable automatic recovery after failover  True
    backup_adapter  ent3           Adapter used when whole channel fails     True
    hash_mode       default        Determines how outgoing adapter is chosen True
    mode            standard       EtherChannel mode of operation            True
    netaddr                        Address to ping                           True
    num_retries     3              Times to retry ping before failing        True
    retry_time      1              Wait time (in seconds) between pings      True
    use_alt_addr    no             Enable Alternate EtherChannel Address     True
    use_jumbo_frame no             Enable Gigabit Ethernet Jumbo Frames      True

至于网卡的工作状态,还可以通过netstat -v来查看,如:

#netstat -v ent4

    ETHERNET STATISTICS (ent4) :
    Device Type: EtherChannel
    Hardware Address: 00:14:5e:b7:26:88
    ......

    Number of adapters: 3
    Active channel: primary channel
    Operating mode: Standard mode
    Hash mode: Destination IP address
    ......

    ETHERNET STATISTICS (ent1) :
    Link Status : Up
    Media Speed Selected: Auto negotiation
    Media Speed Running: 1000 Mbps Full Duplex
    ......

    ETHERNET STATISTICS (ent2) :
    Link Status : Up
    Media Speed Selected: Auto negotiation
    Media Speed Running: 1000 Mbps Full Duplex
    ......

    Backup adapter - ent3:
    ======================
    Link Status : Up
    Media Speed Selected: Auto negotiation
    Media Speed Running: 1000 Mbps Full Duplex

如果想取消绑定,则同样执行

#smit etherchannel

选择

Remove An EtherChannel / Link Aggregation

选择你需要取消的网卡,如上面的ent4,回车执行

    Command: OK            stdout: yes           stderr: no
    Before command completion, additional instructions may appear below.
    ent4 deleted

如果得到以上的结果,表示绑定取消成功。成功的结果,可以通过lsdev -Cc adapter前后对比获得。

||||||||||||||||||||||||
实际操作后验证

# errpt -dH
IDENTIFIER TIMESTAMP  T C RESOURCE_NAME  DESCRIPTION
F3931284   1229151609 I H ent4           ETHERNET NETWORK RECOVERY MODE
8650BE3F   1229151609 I H ent6           ETHERCHANNEL RECOVERY
F3931284   1229151609 I H ent0           ETHERNET NETWORK RECOVERY MODE
AA8D7232   1229151009 I H ent6           TOTAL ETHERCHANNEL FAILURE
EC0BCCD4   1229151009 T H ent4           ETHERNET DOWN
F3846E13   1229150909 P H ent6           ETHERCHANNEL FAILOVER
EC0BCCD4   1229150909 T H ent0           ETHERNET DOWN
8650BE3F   1229150009 I H ent6           ETHERCHANNEL RECOVERY
F3931284   1229145909 I H ent0           ETHERNET NETWORK RECOVERY MODE
F3846E13   1229145909 P H ent6           ETHERCHANNEL FAILOVER
EC0BCCD4   1229145909 T H ent0           ETHERNET DOWN
AA8D7232   1229143009 I H ent6           TOTAL ETHERCHANNEL FAILURE
EC0BCCD4   1229143009 T H ent4           ETHERNET DOWN
F3846E13   1229143009 P H ent6           ETHERCHANNEL FAILOVER
EC0BCCD4   1229143009 T H ent0           ETHERNET DOWN


ent6是聚合端口,ent0和ent4是什么呢,查下他们的属性
# ifconfig -a
en1: flags=5e080863,c0<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),PSEG,LARGESEND,CHAIN>
        inet 10.1.1.2 netmask 0xffffff00 broadcast 10.1.1.255
         tcp_sendspace 131072 tcp_recvspace 65536 rfc1323 0
en6: flags=5e080863,c0<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),PSEG,LARGESEND,CHAIN>
        inet 192.168.168.102 netmask 0xffffff00 broadcast 192.168.168.255
        inet 192.168.200.2 netmask 0xffffff00 broadcast 192.168.200.255
         tcp_sendspace 131072 tcp_recvspace 65536 rfc1323 0
lo0: flags=e08084b<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT>
        inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
        inet6 ::1/0

# lsattr -El ent6
adapter_names   ent0           EtherChannel Adapters                       True
alt_addr        0x000000000000 Alternate EtherChannel Address              True
auto_recovery   yes            Enable automatic recovery after failover    True
backup_adapter  ent4           Adapter used when whole channel fails       True
hash_mode       default        Determines how outgoing adapter is chosen   True
mode            standard       EtherChannel mode of operation              True
netaddr         0              Address to ping                             True
noloss_failover yes            Enable lossless failover after ping failure True
num_retries     3              Times to retry ping before failing          True
retry_time      1              Wait time (in seconds) between pings        True
use_alt_addr    no             Enable Alternate EtherChannel Address       True
use_jumbo_frame no             Enable Gigabit Ethernet Jumbo Frames        True

可见ent0 ent6聚合端口的主口,ent4是辅口,如果ent0挂了,网络ip 会接管到ent4上去。

用如下命令可以查看详细信息(关键信息为红字)
# netstat -v ent6
-------------------------------------------------------------
ETHERNET STATISTICS (ent6) :
Device Type: EtherChannel
Hardware Address: 00:14:5e:c8:20:d4
Elapsed Time: 0 days 19 hours 17 minutes 21 seconds

Transmit Statistics:                          Receive Statistics:
--------------------                          -------------------
Packets: 573353                               Packets: 763977
Bytes: 82887809                               Bytes: 152026709
Interrupts: 0                                 Interrupts: 726784
Transmit Errors: 0                            Receive Errors: 0
Packets Dropped: 0                            Packets Dropped: 0
                                              Bad Packets: 0
Max Packets on S/W Transmit Queue: 16       
S/W Transmit Queue Overflow: 0
Current S/W+H/W Transmit Queue Length: 1

Elapsed Time: 0 days 0 hours 0 minutes 0 seconds
Broadcast Packets: 470                        Broadcast Packets: 181229
Multicast Packets: 1                          Multicast Packets: 0
No Carrier Sense: 0                           CRC Errors: 0
DMA Underrun: 0                               DMA Overrun: 0
Lost CTS Errors: 0                            Alignment Errors: 0
Max Collision Errors: 0                       No Resource Errors: 0
Late Collision Errors: 0                      Receive Collision Errors: 0
Deferred: 0                                   Packet Too Short Errors: 0
SQE Test: 0                                   Packet Too Long Errors: 0
Timeout Errors: 0                             Packets Discarded by Adapter: 0
Single Collision Count: 0                     Receiver Start Count: 0
Multiple Collision Count: 0
Current HW Transmit Queue Length: 1

General Statistics:
-------------------
No mbuf Errors: 0
Adapter Reset Count: 2
Adapter Data Rate: 2000
Driver Flags: Up Broadcast Running
        Simplex 64BitSupport ChecksumOffload
        PrivateSegment LargeSend DataRateSet

=============================================================
=============================================================

Statistics for every adapter in the EtherChannel:
-------------------------------------------------

Number of adapters: 2
Active channel: primary channel
Operating mode: Network interface backup mode

-------------------------------------------------------------

ETHERNET STATISTICS (ent0) :
Device Type: 2-Port 10/100/1000 Base-TX PCI-X Adapter (14108902)
Hardware Address: 00:14:5e:c8:20:d4

Transmit Statistics:                          Receive Statistics:
--------------------                          -------------------
Packets: 572652                               Packets: 672530
Bytes: 82820781                               Bytes: 135221262
Interrupts: 0                                 Interrupts: 642577
Transmit Errors: 0                            Receive Errors: 0
Packets Dropped: 0                            Packets Dropped: 0
                                              Bad Packets: 0
Max Packets on S/W Transmit Queue: 13       
S/W Transmit Queue Overflow: 0
Current S/W+H/W Transmit Queue Length: 2

Broadcast Packets: 450                        Broadcast Packets: 90472
Multicast Packets: 1                          Multicast Packets: 0
No Carrier Sense: 0                           CRC Errors: 0
DMA Underrun: 0                               DMA Overrun: 0
Lost CTS Errors: 0                            Alignment Errors: 0
Max Collision Errors: 0                       No Resource Errors: 0
Late Collision Errors: 0                      Receive Collision Errors: 0
Deferred: 0                                   Packet Too Short Errors: 0
SQE Test: 0                                   Packet Too Long Errors: 0
Timeout Errors: 0                             Packets Discarded by Adapter: 0
Single Collision Count: 0                     Receiver Start Count: 0
Multiple Collision Count: 0
Current HW Transmit Queue Length: 2

General Statistics:
-------------------
No mbuf Errors: 0
Adapter Reset Count: 1
Adapter Data Rate: 2000
Driver Flags: Up Broadcast Running
        Simplex 64BitSupport ChecksumOffload
        PrivateSegment LargeSend DataRateSet

2-Port 10/100/1000 Base-TX PCI-X Adapter (14108902) Specific Statistics:
------------------------------------------------------------------------
Link Status : Up
Media Speed Selected: Auto negotiation
Media Speed Running: 1000 Mbps Full Duplex
PCI Mode: PCI-X (100-133)
PCI Bus Width: 64-bit
Latency Timer: 144
Cache Line Size: 128
Jumbo Frames: Disabled
TCP Segmentation Offload: Enabled
TCP Segmentation Offload Packets Transmitted: 2434
TCP Segmentation Offload Packet Errors: 0
Transmit and Receive Flow Control Status: Enabled
XON Flow Control Packets Transmitted: 0
XON Flow Control Packets Received: 0
XOFF Flow Control Packets Transmitted: 0
XOFF Flow Control Packets Received: 0
Transmit and Receive Flow Control Threshold (High): 45056
Transmit and Receive Flow Control Threshold (Low): 24576
Transmit and Receive Storage Allocation (TX/RX): 16/48

-------------------------------------------------------------
Backup adapter - ent4:
======================

ETHERNET STATISTICS (ent4) :
Device Type: 2-Port 10/100/1000 Base-TX PCI-X Adapter (14108902)
Hardware Address: 00:14:5e:c8:20:d4

Transmit Statistics:                          Receive Statistics:
--------------------                          -------------------
Packets: 702                                  Packets: 91447
Bytes: 67088                                  Bytes: 16805447
Interrupts: 0                                 Interrupts: 84207
Transmit Errors: 0                            Receive Errors: 0
Packets Dropped: 0                            Packets Dropped: 0
                                              Bad Packets: 0
Max Packets on S/W Transmit Queue: 3        
S/W Transmit Queue Overflow: 0
Current S/W+H/W Transmit Queue Length: 0

Broadcast Packets: 20                         Broadcast Packets: 90757
Multicast Packets: 0                          Multicast Packets: 0
No Carrier Sense: 0                           CRC Errors: 0
DMA Underrun: 0                               DMA Overrun: 0
Lost CTS Errors: 0                            Alignment Errors: 0
Max Collision Errors: 0                       No Resource Errors: 0
Late Collision Errors: 0                      Receive Collision Errors: 0
Deferred: 0                                   Packet Too Short Errors: 0
SQE Test: 0                                   Packet Too Long Errors: 0
Timeout Errors: 0                             Packets Discarded by Adapter: 0
Single Collision Count: 0                     Receiver Start Count: 0
Multiple Collision Count: 0
Current HW Transmit Queue Length: 0

General Statistics:
-------------------
No mbuf Errors: 0
Adapter Reset Count: 1
Adapter Data Rate: 2000
Driver Flags: Up Broadcast Running
        Simplex 64BitSupport ChecksumOffload
        PrivateSegment LargeSend DataRateSet

2-Port 10/100/1000 Base-TX PCI-X Adapter (14108902) Specific Statistics:
------------------------------------------------------------------------
Link Status : Up
Media Speed Selected: Auto negotiation
Media Speed Running: 1000 Mbps Full Duplex
PCI Mode: PCI-X (50-66)
PCI Bus Width: 32-bit
Latency Timer: 144
Cache Line Size: 128
Jumbo Frames: Disabled
TCP Segmentation Offload: Enabled
TCP Segmentation Offload Packets Transmitted: 0
TCP Segmentation Offload Packet Errors: 0
Transmit and Receive Flow Control Status: Enabled
XON Flow Control Packets Transmitted: 0
XON Flow Control Packets Received: 0
XOFF Flow Control Packets Transmitted: 0
XOFF Flow Control Packets Received: 0
Transmit and Receive Flow Control Threshold (High): 45056
Transmit and Receive Flow Control Threshold (Low): 24576
Transmit and Receive Storage Allocation (TX/RX): 16/48

你可能感兴趣的:(command,AIX,NetWork,alignment,statistics,Allocation)