[root@redhat network-scripts]# cat ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
NETWORK=192.168.0.128
IPADDR=192.168.0.154
NETMASK=255.255.255.224
GATEWAY=192.168.0.129
USERCTL=no

[root@redhat network-scripts]# cat ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no

[root@redhat network-scripts]# cat ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no

[root@redhat network-scripts]# ifconfig
bond0     Link encap:Ethernet  HWaddr 00:10:18:00:95:E3
          inet addr:192.168.0.154  Bcast:192.168.0.159  Mask:255.255.255.224
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11015965 errors:0 dropped:4 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:1382772266 (1318.7 Mb)

eth0      Link encap:Ethernet  HWaddr 00:10:18:00:95:E3
          inet addr:192.168.0.154  Bcast:192.168.0.159  Mask:255.255.255.224
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:132884 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5507979 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9832436 (9.3 Mb)  TX bytes:2859931727 (2727.4 Mb)
          Interrupt:43 Memory:efff0000-f0000000

eth1      Link encap:Ethernet  HWaddr 00:10:18:00:95:E3
          inet addr:192.168.0.154  Bcast:192.168.0.159  Mask:255.255.255.224
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:10070086 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5507979 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1593187907 (1519.3 Mb)  TX bytes:2862573694 (2729.9 Mb)
          Interrupt:24 Memory:effe0000-efff0000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4425618 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4425618 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:611116989 (582.8 Mb)  TX bytes:611116989 (582.8 Mb)

[root@redhat network-scripts]# cat /etc/modules.conf
alias parport_lowlevel parport_pc
alias scsi_hostadapter ips
alias usb-controller usb-ohci
alias bond0 bonding
alias eth0 bcm5700
alias eth1 bcm5700

[root@redhat network-scripts]# ethtool eth0
Settings for eth0:
        Supported ports: [ FIBRE ]
        Supported link modes:   1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: FIBRE
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: d
        Wake-on: d
        Link detected: yes
[root@redhat network-scripts]# ethtool eth1
Settings for eth1:
        Supported ports: [ FIBRE ]
        Supported link modes:   1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: FIBRE
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: d
        Wake-on: d
        Link detected: yes

Reference
http://anti1346.egloos.com/4695354

1. Bonding 개요

 

본딩이란 여러 개의 NIC를 논리적으로 하나로 묶어 NIC의 개수만큼의 대역폭을 확장하는 기술이다.

예를들어 100Mbps NIM 두 개를 묶어 200Mbps의 대역폭으로 구성 할 수 있다.

또한 NIC가 두 개이기 때문에 물리적인 경로 또한 두 개가 생긴다. 이것은 곧, 네트워크의 이중화라고

말 할 수 있다. 하나의 NIC 장애 시 남은 하나의 NIC로 통신이 가능하여 Fault It Tolerancedml 역할을 한다.

또한 두 개의 경로에서 패킷을 적절히 분배 할 수 있는 로드 밸런싱 기능까지 구현 할 수 있다.

 

2. 테스트 환경

 

- OS 커널 : 2.6.X 커널 사용

(

> Linux 2.6.x 커널에서는 Teaming이라는 용어 대신 bonding으로 바뀌었으면 2.4.x 커널에서 이용을

하려고 할 경우 ifenslave를 업데이트를 하거나 2.4.12 커널 이상으로 커널 컴파일을 실시하여야 한다.

> Ifenslave를 업데이트하여 사용을 할 경우 정상적으로 동작을 되지 않을 수 있으므로 2.6.x 의 버전을

설치하는 것을 추천한다.

)

- NIC 2

[root@byun named]# mii-tool

eth0: negotiated 100baseTx-FD flow-control, link ok

eth1: negotiated 100baseTx-FD flow-control, link ok

 

3. Bonding 구성

 

3-1. 네트워크 환경 구성 파일 설정

 

ifcfg-bond0  <= 추가 생성

vi /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0

ONBOOT=yes

BOOTPROTO=static

IPADDR=10.0.1.138

NETMASK=255.255.255.0

 

ifcfg-eth0 수정 및 생성

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

USERCTL=no  <= root가 아닌 일반계정이 해당 인터페이스를 비활성화 가능 여부

MASTER=bond0

SLAVE=yes

BOOTPROTO=static

ONBOOT=yes

 

ifcfg-eth1 수정 및 생성

vi /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

USERCTL=no

MASTER=bond0

SLAVE=yes

BOOTPROTO=static

ONBOOT=yes

 

network 수정 및 생성

vi /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=byun

GATEWAY=10.0.1.1

GATEDEV=bond0  <= 추가 사항

 

3-2. 모듈 구성

 

modprobe.conf bond 모듈 추가

vi /etc/modprobe.conf

alias eth0 e1000

alias eth1 e1000

alias scsi_hostadapter aic79xx

alias scsi_hostadapter1 ata_piix

alias usb-controller uhci-hcd

#

# bonding 추가

alias bond0 bonding

options bonding mode=6  <= bonding 방식 지정 : 6

options bond0 miimon=100  <= NIC Health 체크 시간(1/100 sec)

 

[Bonding 모드 종류]

 

0 : Balance-round robine 정책 : 첫 번째 가능한 슬레이브부터 마지막까지 순차적으로 전송한다. 이 모드는

부하분산과 장애 감내를 제공한다.

 

1 : Active-backup 정책 : bond에서 하나의 슬레이브만 활성화된다. 다른 슬레이브는 활성화된 슬레이브가  

fail 된 경우에만 활성화 된다.

 

2 : Balance-XOR 정책 : [(출발지 MAC 주소와 도착지 MAC 주소의 XOR) modula 슬레이브 1]에 기초하여

전송한다. 이것은 도착지 MAC 주소에 대해서 동일한 슬레이브를 선택하게 된다. 이 모드는 부하분산과 장

애감지를 제공한다.

 

3 : Broadcast 정책 : 모든 슬레이브 인터페이스에 모든 것을 전송한다. 이것은 장애감내를 제공한다.

 

4 : 802.3ad (link aggregation) - switch aggregation 그룹생성이 필요하다.

 

5 : transmit load 밸런스로써 보내는 패킷만 밸런스 한다.

 

6 : receive transmit패킷을 밸런스 한다. 이때 5,6 은 하나의 스위치에 있을때만 동작한다.

 

bonding 모듈 올리기

 

#modprobe bonding  <= 모듈 올리기

또는

# insmod /lib/modules/"uname -r'/kernel/drivers/net/bonding/bonding.kr miimon=1000 mode=6

 

insmod modprobe의 차이는 insmod 같은 경우에는 직접 모듈을 찾아 올려줘야하는 것이고 modprobe

그와 달리 알아서(의존성이 걸린 모듈까지 전부) 찾아서 올려주는 명령이다

 

모듈 확인 방법

 

# lsmod

[root@byun named]# lsmod | grep bonding  <= 모듈 확인

bonding                68840  0

 

네트워크 IP 주소 정보

 

# ifconfig 확인  => 모두 3개의 인터페이스가 활성화 되었으며 실제 인터페이스에서는

“SLAVE”라는 상태 정보가 생성되어 있다.

[root@byun named]# ifconfig

bond0     Link encap:Ethernet  HWaddr 00:0D:61:35:16:9C

          inet addr:10.0.1.138  Bcast:10.0.1.255  Mask:255.255.255.0

          inet6 addr: fe80::20d:61ff:fe35:169c/64 Scope:Link

          UP BROADCAST RUNNING MASTERMULTICAST  MTU:1500  Metric:1

          RX packets:72815 errors:0 dropped:0 overruns:0 frame:0

          TX packets:67823 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:6308545 (6.0 MiB)  TX bytes:25702842 (24.5 MiB)

 

eth0      Link encap:Ethernet  HWaddr 00:0D:61:35:16:9C

          UP BROADCAST RUNNING SLAVEMULTICAST  MTU:1500  Metric:1

          RX packets:44950 errors:0 dropped:0 overruns:0 frame:0

          TX packets:44091 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:100

          RX bytes:3851533 (3.6 MiB)  TX bytes:24180496 (23.0 MiB)

 

eth1      Link encap:Ethernet  HWaddr 00:0D:61:35:16:9D

          UP BROADCAST RUNNING SLAVEMULTICAST  MTU:1500  Metric:1

          RX packets:27865 errors:0 dropped:0 overruns:0 frame:0

          TX packets:23732 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:100

          RX bytes:2457012 (2.3 MiB)  TX bytes:1522346 (1.4 MiB)

 

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:194 errors:0 dropped:0 overruns:0 frame:0

          TX packets:194 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:13022 (12.7 KiB)  TX bytes:13022 (12.7 KiB)

 

3-3 구성 상태 확인 및 검증

 

bond0 구동 현황 파악

[root@byun named]# cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v2.6.3-rh (June 8, 2005)  <= bonding 버전

 

Bonding Mode: adaptive load balancing  <= Bonding Mode

Primary Slave: None

Currently Active Slave: eth0              <= 현재 Active REAL NIC

MII Status: up                           <= Link 상태

MII Polling Interval (ms): 100             <= Fail 시 전환

Up Delay (ms): 0

Down Delay (ms): 0

 

Slave Interface: eth0

MII Status: up                           <= Link 상태

Link Failure Count: 0                     <= OS startup 이 후 Link Fail 건 수

Permanent HW addr: 00:0d:61:35:16:9c   <= MAC 주소

 

Slave Interface: eth1

MII Status: up

Link Failure Count: 0

Permanent HW addr: 00:0d:61:35:16:9d

 


RX / TX 패킷 확인하기

 

# cat /proc/net/dev (또는 /sbin/ifconfig 의 결과에서 RX/TX 패킷 비교)

                                                                                      (단위 : 패킷 양)

 

 

 

(행의 길이가 길어서 필요한 것만 옮겼음)

 

Inter-|                Receive                                         |           Transmit

 face|                 bytes                  packets             |bytes              packets

lo:                       13222                 198                    13222                198   

bond0:                8704648              99674                27088019           89807

eth0:                   5074179               58607                24916076           55252

eth1:                   3630469              41067                 2171943             34555 

sit0:                    0                         0                        0                       0

 

*)

RX : 받는 패킷(Receive)

TX : 보낸 패킷(Transmit)

-OK : 에러없이 받은 패킷

-ERR : 에러

-DRP : Drop

-OVR : Overrun

 

, 위의 결과는 RX / TX 패킷을 각각 eth0 eth1으로 거의 동일하게 분배해서 보내고 받음을 알 수 있다.

출처:bonding




http://ftth3.tistory.com/253



+ Recent posts