반응형
이더넷 채널 본딩하기(Bonding)
================================================================
#### bond0
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 1500 qdisc mq master bond0 state DOWN qlen 1000
9: eth7: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
10: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
================================================================
================================================================
#### bond1
2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond1 state UP qlen 1000
8: eth6: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond1 state UP qlen 1000
11: bond1: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
14: bond1.221@bond1: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
15: bond1.222@bond1: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
================================================================
남은 포트 : ================================================================
4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
6: eth4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
7: eth5: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
================================================================
Bonding Num : 2
Ethernet Num1 : 4
Ethernet Num2 : 6
IPADDR : 10.10.10.200
NETMASK : 255.255.255.0
GATEWAY사용유무(y/n) : y
GATEWAY : 10.10.10.1
vim bondingsetup.sh
#!/bin/sh
# 기존 구성 Bondingfor BNUM in `ip link show | awk {'print $9'} | sort -u -k1,1 | grep bond`
do
echo "=============================================================="
echo "####" $BNUM
ip link show | grep "$BNUM"
echo -e "==============================================================\n"
done
echo "남은 포트 : "echo "=============================================================="
ip link show | egrep -v 'link/ether|LOOPBACK|loopback|bond'
echo "=============================================================="
echo -e "\n"
echo -e "\n"
# Bonding Ethernet
echo -n "Bonding Num : "
read BONDINGAA
echo -n "Ethernet Num1 : "
read ETH1
echo -n "Ethernet Num2 : "
read ETH2
#IP 주소echo -n "IPADDR : "
read IPADDRAA
echo -n "NETMASK : "
read NETMASKAA
echo -n "GATEWAY사용유무(y/n) : "read type
if [ $type = y ]
then
echo -n "GATEWAY : "
read GATEWAYAA
break
fi
cd /etc/sysconfig/network-scripts
cat <<EOF >> ifcfg-bond$BONDINGAA
DEVICE=bond$BONDINGAA
TYPE=Ethernet
BOOTPROTO=none
NM_CONTROLLED=none
ONBOOT=yes
USERCTL=no
IPADDR=$IPADDRAA
NETMASK=$NETMASKAA
GATEWAY=$GATEWAYAA
BONDING_OPTS="mode=1 miimon=100"
EOF
cat /dev/null > ifcfg-eth$ETH1
cat <<EOF >> ifcfg-eth$ETH1
DEVICE=eth$IETH1
TYPE=Ethernet
BOOTPROTO=none
IPV6INIT=no
NM_CONTROLLED=no
ONBOOT=yes
USERCTL=no
MASTER=bond$BONDINGAA
SLAVE=yes
EOF
cat /dev/null > ifcfg-eth$ETH2
cat <<EOF >> ifcfg-eth$ETH2
DEVICE=eth$ETH2
BOOTPROTO=none
IPV6INIT=no
NM_CONTROLLED=no
ONBOOT=yes
USERCTL=no
MASTER=bond$BONDINGAA
SLAVE=yes
EOF
echo "alias bond$BONDINGAA bonding" >> /etc/modprobe.d/bonding.conf
chmmod +x bondingsetup.sh
728x90
반응형
'스크립트' 카테고리의 다른 글
DNS(named) 서비스를 모니터링하는 스크립트 (0) | 2014.03.10 |
---|---|
linux system backup 스크립트 (0) | 2014.03.10 |
액세스 로그 백업 스크립트 (0) | 2013.12.24 |
[스크립트] 리눅스에서 ping 테스트 시 시작 표시하기(ping 정상 Bell 울림) (0) | 2013.09.10 |
아파치 서버의 로그 저장 스크립트 (0) | 2013.08.14 |