출처 http://celltwo.tistory.com/115
1. 본딩(bonding)이란?
여러개의 NIC을 논리적으로 묶어서 한개의 NIC으로 묶어서 NIC의 갯수 만큼 대역폭을 확장하는 기술이다. 100M의 NIC을 2개를 묶어서 200M의 NIC으로 구성 할 수도 있으며, 2개의 NIC을 한개의 NIC으로 묶어서 active와 stand by로 구성을 할 수도 있다.(Fault Tolerance의 역할을 한다)
아래에서는 뒤에 언급한 active와 stand by를 구성 할 것이다.
VMware에서 테스트를 하였으며, OS는 CentOS 5.5 i386 버전을 사용하였다.
2. 본딩을 하기 위해서 네트워크 환경을 변경한다.
[root@CentOS ~]#
[root@CentOS ~]# cd /etc/sysconfig/network-scripts/
[root@CentOS network-scripts]# vi ifcfg-bond0
# ifcfg-bond0 파일은 생성해야 하며, 아래 값을 넣으면 된다.
DEVICE=bond0
BOOTPROTO=none
IPADDR=192.168.133.130
NETMASK=255.255.255.0
ONBOOT=yes
USERCTL=no
[root@CentOS network-scripts]# vi ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
DHCP_HOSTNAME=CentOS
아래와 같이 변경한다.
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
USERCTL=no
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
ONBOOT=yes
DHCP_HOSTNAME=CentOS
[root@CentOS network-scripts]# vi ifcfg-eth1
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth1
BOOTPROTO=dhcp
ONBOOT=yes
DHCP_HOSTNAME=CentOS
아래와 같이 변경한다.
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth1
USERCTL=no
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
ONBOOT=yes
DHCP_HOSTNAME=CentOS
[root@CentOS network-scripts]# cd /etc/sysconfig/
[root@CentOS sysconfig]# vi network # 기존 내용에 GATEDEV 항목을 추가하여 호스트네임 및 게이트웨이 주소를 설정한다.
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=CentOS
아래와 같이 변경한다.
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=CentOS
GATEWAY=192.168.133.2
GATEDEV=bond0
3. 모듈을 구성한다.
DEVICE=eth0
USERCTL=no
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
ONBOOT=yes
DHCP_HOSTNAME=CentOS
[root@CentOS network-scripts]# vi ifcfg-eth1
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth1
BOOTPROTO=dhcp
ONBOOT=yes
DHCP_HOSTNAME=CentOS
아래와 같이 변경한다.
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth1
USERCTL=no
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
ONBOOT=yes
DHCP_HOSTNAME=CentOS
[root@CentOS network-scripts]# cd /etc/sysconfig/
[root@CentOS sysconfig]# vi network # 기존 내용에 GATEDEV 항목을 추가하여 호스트네임 및 게이트웨이 주소를 설정한다.
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=CentOS
아래와 같이 변경한다.
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=CentOS
GATEWAY=192.168.133.2
GATEDEV=bond0
3. 모듈을 구성한다.
[Bonding 모드 종류]
0 : balance-round robine ( 2개의 NIC를 통한 분배 + Fault Tolerance )
1 : active-standby ( Active상태의 NIC에 문제 발생시 Fault Tolerance )
2 : balance-xor ( 0과 비슷하지만 xor연산을 이용한 목적지 Mac과 근원지 Mac을 이용한
분배 + Fault tolerance)
3 : broadcast ( 2개의 NIC에 어떤 규칙 없이 데이터 통신 + Fault Tolerace)
4 : 802.3ad (link aggregation) – switch 에 aggregation 그룹생성이 필요
[root@CentOS sysconfig]# cd /etc/
[root@CentOS etc]# vi modprobe.conf
alias eth0 vmnics
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptspi
alias scsi_hostadapter2 ata_piix
alias snd-card-0 snd-ens1371
options snd-card-0 index=0
options snd-ens1371 index=0
remove snd-ens1371 { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-ens1371
# Added by VMware Tools
install pciehp /sbin/modprobe -q --ignore-install acpiphp; /bin/true
install pcnet32 (/sbin/modprobe -q --ignore-install vmxnet || /sbin/modprobe -q --ignore-install pcnet32 $CMDLINE_OPTS);/bin/true
아래와 같이 변경한다.
alias bond0 bonding
options bonding mode=1 miimon=100
alias eth0 vmnics
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptspi
alias scsi_hostadapter2 ata_piix
alias snd-card-0 snd-ens1371
options snd-card-0 index=0
options snd-ens1371 index=0
remove snd-ens1371 { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-ens1371
# Added by VMware Tools
install pciehp /sbin/modprobe -q --ignore-install acpiphp; /bin/true
install pcnet32 (/sbin/modprobe -q --ignore-install vmxnet || /sbin/modprobe -q --ignore-install pcnet32 $CMDLINE_OPTS);/bin/true
[root@CentOS etc]# modprobe bonding
[root@CentOS etc]# lsmod | grep bonding
bonding 96873 0
ipv6 270305 20 bonding,ip6t_REJECT
[root@CentOS etc]# service network restart
Shutting down interface bond0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface bond0: [ OK ]
[root@CentOS etc]# ifconfig
bond0 Link encap:Ethernet HWaddr 00:0C:29:19:6A:0B
inet addr:192.168.133.130 Bcast:192.168.133.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe19:6a0b/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:375748 errors:0 dropped:0 overruns:0 frame:0
TX packets:66381 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:521476866 (497.3 MiB) TX bytes:3808569 (3.6 MiB)
[root@CentOS etc]# vi modprobe.conf
alias eth0 vmnics
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptspi
alias scsi_hostadapter2 ata_piix
alias snd-card-0 snd-ens1371
options snd-card-0 index=0
options snd-ens1371 index=0
remove snd-ens1371 { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-ens1371
# Added by VMware Tools
install pciehp /sbin/modprobe -q --ignore-install acpiphp; /bin/true
install pcnet32 (/sbin/modprobe -q --ignore-install vmxnet || /sbin/modprobe -q --ignore-install pcnet32 $CMDLINE_OPTS);/bin/true
아래와 같이 변경한다.
alias bond0 bonding
options bonding mode=1 miimon=100
alias eth0 vmnics
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptspi
alias scsi_hostadapter2 ata_piix
alias snd-card-0 snd-ens1371
options snd-card-0 index=0
options snd-ens1371 index=0
remove snd-ens1371 { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-ens1371
# Added by VMware Tools
install pciehp /sbin/modprobe -q --ignore-install acpiphp; /bin/true
install pcnet32 (/sbin/modprobe -q --ignore-install vmxnet || /sbin/modprobe -q --ignore-install pcnet32 $CMDLINE_OPTS);/bin/true
[root@CentOS etc]# modprobe bonding
[root@CentOS etc]# lsmod | grep bonding
bonding 96873 0
ipv6 270305 20 bonding,ip6t_REJECT
[root@CentOS etc]# service network restart
Shutting down interface bond0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface bond0: [ OK ]
[root@CentOS etc]# ifconfig
bond0 Link encap:Ethernet HWaddr 00:0C:29:19:6A:0B
inet addr:192.168.133.130 Bcast:192.168.133.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe19:6a0b/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:375748 errors:0 dropped:0 overruns:0 frame:0
TX packets:66381 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:521476866 (497.3 MiB) TX bytes:3808569 (3.6 MiB)
eth0 Link encap:Ethernet HWaddr 00:0C:29:19:6A:0B
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:374350 errors:0 dropped:0 overruns:0 frame:0
TX packets:66273 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:521326235 (497.1 MiB) TX bytes:3792400 (3.6 MiB)
Interrupt:67 Base address:0x2024
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:374350 errors:0 dropped:0 overruns:0 frame:0
TX packets:66273 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:521326235 (497.1 MiB) TX bytes:3792400 (3.6 MiB)
Interrupt:67 Base address:0x2024
eth1 Link encap:Ethernet HWaddr 00:0C:29:19:6A:0B
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:1403 errors:0 dropped:0 overruns:0 frame:0
TX packets:117 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:150931 (147.3 KiB) TX bytes:17551 (17.1 KiB)
Interrupt:67 Base address:0x2424
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:1403 errors:0 dropped:0 overruns:0 frame:0
TX packets:117 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:150931 (147.3 KiB) TX bytes:17551 (17.1 KiB)
Interrupt:67 Base address:0x2424
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:2860 errors:0 dropped:0 overruns:0 frame:0
TX packets:2860 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5845622 (5.5 MiB) TX bytes:5845622 (5.5 MiB)
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:2860 errors:0 dropped:0 overruns:0 frame:0
TX packets:2860 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5845622 (5.5 MiB) TX bytes:5845622 (5.5 MiB)
[root@CentOS etc]#
4. 구성 상태 확인 및 구성 상태 검증
[root@CentOS etc]# cd /proc/net/bonding/
[root@CentOS bonding]# cat bond0
Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008) # bonding의 버전 정보
4. 구성 상태 확인 및 구성 상태 검증
[root@CentOS etc]# cd /proc/net/bonding/
[root@CentOS bonding]# cat bond0
Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008) # bonding의 버전 정보
Bonding Mode: fault-tolerance (active-backup) # 구성된 bonding의 모드 관련 정보
Primary Slave: None
Currently Active Slave: eth0 # 현재 Active 상태의 인터페이스 정보
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
Primary Slave: None
Currently Active Slave: eth0 # 현재 Active 상태의 인터페이스 정보
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:19:6a:0b
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:19:6a:0b
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:19:6a:15
[root@CentOS bonding]#
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:19:6a:15
[root@CentOS bonding]#
'리눅스' 카테고리의 다른 글
특정 폴더 또는 파일 제외하고 압축하기 (0) | 2012.03.29 |
---|---|
특정 폴더 또는 파일만 압축풀기 (0) | 2012.03.29 |
CentOS5 에 Oracle 10g 올리기 (0) | 2012.03.29 |
vsftpd.conf 설정 (0) | 2012.03.28 |
리눅스 시스템 로그(Log) 분석 (0) | 2012.03.28 |