标签:man via ash div linux网络 script stat ati ifd
#!/bin/bash ip=$1 if [ -f "/etc/sysconfig/network-scripts/ifcfg-bond1" ] then break else #ip=`ip a | grep -E "192.|10." | grep -v ":" | awk ‘{ print $2 }‘ | awk -F‘/‘ ‘{ print $1 }‘` gw=`echo $ip | awk -F"." ‘{ print $1"."$2"."$3".254" }‘` sed -i ‘s/enforcing/disable/g‘ /etc/selinux/config setenforce 0 service iptables stop ifdown em1 service NetworkManager stop chkconfig NetworkManager off chkconfig iptables off cp /etc/sysconfig/network-scripts/ifcfg-em1 /etc/sysconfig/network-scripts/ifcfg-em1.bak cp /etc/sysconfig/network-scripts/ifcfg-em2 /etc/sysconfig/network-scripts/ifcfg-em2.bak cp /etc/sysconfig/network-scripts/ifcfg-em3 /etc/sysconfig/network-scripts/ifcfg-em3.bak cp /etc/sysconfig/network-scripts/ifcfg-em4 /etc/sysconfig/network-scripts/ifcfg-em4.bak cat > /etc/sysconfig/network-scripts/ifcfg-em1 <<EOF DEVICE=em1 BOOTPROTO="none" NM_CONTROLLED="no" ONBOOT="yes" MASTER="bond0" SLAVE="yes" EOF cat > /etc/sysconfig/network-scripts/ifcfg-em2 <<EOF DEVICE=em2 BOOTPROTO="none" NM_CONTROLLED="no" ONBOOT="yes" MASTER="bond1" SLAVE="yes" EOF cat > /etc/sysconfig/network-scripts/ifcfg-em3 <<EOF DEVICE=em3 BOOTPROTO="none" NM_CONTROLLED="no" ONBOOT="yes" MASTER="bond0" SLAVE="yes" EOF cat > /etc/sysconfig/network-scripts/ifcfg-em4 <<EOF DEVICE=em4 BOOTPROTO="none" NM_CONTROLLED="no" ONBOOT="yes" MASTER="bond1" SLAVE="yes" EOF cat > /etc/sysconfig/network-scripts/ifcfg-bond0 <<EOF DEVICE=bond0 ONBOOT=no BOOTPROTO=static #IPADDR=x.x.x.x #NETMASK=255.255.255.0 #GATEWAY=x.x.x.x BONDING_OPTS="mode=6 miimon=1000" EOF cat > /etc/sysconfig/network-scripts/ifcfg-bond1 <<EOF DEVICE=bond1 TYPE=bond6 ONBOOT=yes BOOTPROTO=static IPADDR=$ip NETMASK=255.255.255.0 #GATEWAY=192.168.4.254 BONDING_OPTS="mode=6 miimon=1000" EOF echo "10.0.0.0/8 via $gw dev bond1" >> /etc/sysconfig/network-scripts/route-bond1 echo "192.168.0.0/16 via $gw dev bond1" >> /etc/sysconfig/network-scripts/route-bond1 ifdown em2 && service network restart fi
标签:man via ash div linux网络 script stat ati ifd
原文地址:http://www.cnblogs.com/pythonal/p/7519829.html