Last active
July 21, 2021 15:59
-
-
Save hsteiger/c83de1d8b3e4fec749258d7853af6a31 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Configurando os IPs do Servidor | |
IFPRINCIPAL=`ifconfig |cut -f1 -d" "|grep ^[^lo]|head -n1|cut -f1 -d:` | |
echo "Configurando os IPs do Servidor..." | |
IPs=`cat /root/IPs.txt` | |
QTDIPS=`cat /root/IPs.txt|wc -l` | |
if [ QTDIPS = '1' ]; then | |
1IP=`head /root/IPs.txt` | |
echo $1IP >> /root/IPs.txt | |
echo "Ha apenas 1 IP, não é necessario configurar os IPs..." | |
else | |
INT=0 | |
ETHS="/etc/sysconfig/network-scripts/ifcfg-$IFPRINCIPAL" | |
for ip in $IPs; do | |
echo "DEVICE=$IFPRINCIPAL:$INT" > $ETHS:$INT | |
echo "BOOTPROTO=static" >> $ETHS:$INT | |
echo "IPADDR=$ip" >> $ETHS:$INT | |
echo "NETMASK=255.255.255.255" >> $ETHS:$INT | |
echo "ONBOOT=yes" >> $ETHS:$INT | |
echo "ARPCHECK=no" >> $ETHS:$INT | |
let INT=$INT+1 | |
done | |
/etc/init.d/network restart | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment