변군이글루

[스크립트] 이더넷 채널 본딩하기(Bonding) 본문

문___스크립트

[스크립트] 이더넷 채널 본딩하기(Bonding)

변군 변군이글루 2014.02.28 13:24

이더넷 채널 본딩하기

 

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

#### 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

 

 

#!/bin/sh

 

# 기존 구성 Bonding

for 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

 

 

 

bondingsetup.sh

 

 

 

 

0 Comments
댓글쓰기 폼
Prev 1 2 3 4 5 6 7 8 9 Next