Created
June 26, 2011 04:01
-
-
Save n0ts/1047220 to your computer and use it in GitHub Desktop.
create brdige from ethX to brX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for iface in /etc/sysconfig/network-scripts/ifcfg-eth*; do | |
iface_name=`egrep "^DEVICE=" $iface` | |
iface_no=${iface_name##DEVICE=eth} | |
iface_br=ifcfg-br${iface_no} | |
cp $iface $iface_br | |
sed -i -e "s/^DEVICE=eth${iface_no}/DEVICE=br${iface_no}/g" $iface_br | |
sed -i -e 's/^HWADDR=/#HWADDR=/g' $iface_br | |
echo "TYPE=Bridge" >> $iface_br | |
sed -i -e "s/^BOOTPROTO=/#BOOTPROTO=/g" $iface | |
sed -i -e 's/^BROADCAST=/#BROADCAST=/g' $iface | |
sed -i -e 's/^IPADDR=/#IPADDR=/g' $iface | |
sed -i -e 's/^NETMASK=/#NETMASK=/g' $iface | |
sed -i -e 's/^NETWORK=/#NETWORK=/g' $iface | |
sed -i -e 's/^DNS1=/#DNS1=/g' $iface | |
echo "BRIDGE=br${iface_no}" >> $iface | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment