ubuntu12.04 에서 네트워크 bonding 하기.

bonding, port trunking, link aggreation, teaming 모두 같은 의미로, 네트워크의 HA, 대역폭 확장, 또는 로드밸런싱을 위해 사용한다.

ubuntu를 비롯한 linux에서는 ifenslave 를 이용하여 bonding할 수 있다. 우분투에서는 아래 커맨드로 ifenslave를 설치 할 수 있다.

# apt-get install ifenslave

/etc/modules 화일에 “bonding”을 추가한다.

# cat modules.bak
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

lp
rtc
bonding

커널에 bonding 모듈을 올려준다. 처음에는 bonding 모듈이 load 되어 있지 않을 것이다.

# lsmod | grep -i bond

bonding 모듈을 loading 한다. 잘 올라온다면, lsmod 결과가 아래와 같을 것이다.

# modprobe bonding
# lsmod | grep -i bond
bonding 109848 0

네트워크를 정지시킨다. (/etc/init.d/networking stop) . 정지시키지 않는다면, 설정 완료후, 재부팅을 해야한다.

/etc/network/interfaces 화일을 아래와 같이 수정한다. eth0, eth1 두개의 인터페이스를 bonding 하는 경우이다.

# The primary network interface
auto eth0
iface eth0 inet manual
bond-master bond0
auto eth1
iface eth1 inet manual
bond-master bond0
auto bond0
#iface eth0 inet dhcp
iface bond0 inet static
address 192.168.100.50
netmask 255.255.255.0
gateway 192.168.100.1

bond-mode 802.3ad
bond-miimon 100
bond-lacp-rate 1
bond-slaves none

네트워크를 시작한다.(/etc/init.d/networking start)

bond-mode는 0~6 번까지 있다.

balance-rr : 송신할 패킷마다 사용하는 NIC을 바꾼다.(round robin)
active-backup : 첫번째 NIC이 고장나지 않는 동안에는 그 NIC만 사용하다가 고장나면 다음 NIC을 사용한다.
balance-xor : 송수신 MAC을 xor해서 사용할 NIC을 결정한다.
broadcast : 송신 패킷을 복사해서 모든 물리 NIC에 대해 동일 패킷이 전송된다.
802.3ad : IEEE 802.3ad 프로토콜을 사용해서 스위치와의 사이에서 동적으로 aggregation을 작성한다.
balance-tlb : 물리 NIC중 가장 부하가 낮은 NIC을 선택해서 송신하고, 수신은 특정 NIC을 사용한다.
balance-alb : 송수신 모두 부하가 낮은 NIC을 사용한다.

답글 남기기

Your email address will not be published.