码迷,mamicode.com
首页 > 其他好文 > 详细

openstack服务器bond脚本

时间:2014-09-25 03:57:08      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:bond0

#!/bin/bash

em1_mac=`ifconfig em1 |grep ‘HWaddr‘ |awk ‘{print $5}‘`

em2_mac=`ifconfig em2 |grep ‘HWaddr‘ |awk ‘{print $5}‘`

em3_mac=`ifconfig em3 |grep ‘HWaddr‘ |awk ‘{print $5}‘`

em4_mac=`ifconfig em4 |grep ‘HWaddr‘ |awk ‘{print $5}‘`


em1="/etc/sysconfig/network-scripts/ifcfg-em1"

em2="/etc/sysconfig/network-scripts/ifcfg-em2"

em3="/etc/sysconfig/network-scripts/ifcfg-em3"

em4="/etc/sysconfig/network-scripts/ifcfg-em4"


ip_address=`ifconfig em1 |grep ‘inet addr‘ |awk ‘{print $2}‘ |awk  -F  ":"  ‘{print $2}‘`



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

touch /etc/sysconfig/network-scripts/ifcfg-bond1

bond0="/etc/sysconfig/network-scripts/ifcfg-bond0"

bond1="/etc/sysconfig/network-scripts/ifcfg-bond1"


echo "DEVICE=em1" > $em1 

echo "HWADDR=$em1_mac" >> $em1 

echo "TYPE=Ethernet" >> $em1 

echo "ONBOOT=yes" >> $em1 

echo "SLAVE=yes" >> $em1 

echo "MASTER=bond0" >> $em1 

echo "BOOTPROTO=none" >> $em1 


echo "DEVICE=em2" > $em2 

echo "HWADDR=$em2_mac" >> $em2 

echo "TYPE=Ethernet" >> $em2 

echo "ONBOOT=yes" >> $em2 

echo "SLAVE=yes" >> $em2 

echo "MASTER=bond0" >> $em2 

echo "BOOTPROTO=none" >> $em2


echo "DEVICE=em3" > $em3 

echo "HWADDR=$em3_mac" >> $em3 

echo "TYPE=Ethernet" >> $em3 

echo "ONBOOT=yes" >> $em3 

echo "SLAVE=yes" >> $em3 

echo "MASTER=bond1" >> $em3 

echo "BOOTPROTO=none" >> $em3


echo "DEVICE=em4" > $em4 

echo "HWADDR=$em4_mac" >> $em4 

echo "TYPE=Ethernet" >> $em4 

echo "ONBOOT=yes" >> $em4 

echo "SLAVE=yes" >> $em4 

echo "MASTER=bond1" >> $em4 

echo "BOOTPROTO=none" >> $em4




echo "DEVICE=bond0" > $bond0

echo "ONBOOT=yes" >> $bond0

echo ‘BONDING_OPTS="miimon=100 mode=0"‘ >> $bond0

echo "BOOTPROTO=static" >> $bond0

echo "IPADDR=$ip_address" >> $bond0

echo "NETMASK=255.255.255.0" >> $bond0



echo "DEVICE=bond1" > $bond1

echo "ONBOOT=yes" >> $bond1

echo ‘BONDING_OPTS="miimon=100 mode=0"‘ >> $bond1

echo "BOOTPROTO=static" >> $bond1


本文出自 “zhanguo1110” 博客,请务必保留此出处http://zhanguo1110.blog.51cto.com/5750817/1557919

openstack服务器bond脚本

标签:bond0

原文地址:http://zhanguo1110.blog.51cto.com/5750817/1557919

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!