Created
May 29, 2017 09:01
-
-
Save simond/ae28ca7794788dbab684dc544f99bc50 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
hostname=$1 | |
publicIP=$2 | |
privateIP=$3 | |
#change hostname and ip in /etc/sysconfig/network and /etc/hosts | |
cp -f /etc/hosts.bak /etc/hosts | |
cp -f /etc/sysconfig/network.bak /etc/sysconfig/network | |
sed -i "s/xxhostnamexx/$hostname/g" /etc/sysconfig/network /etc/hosts | |
sed -i "s/xxpublicipxx/$publicIP/g" /etc/hosts | |
hostname $hostname | |
#change ip addresses in /etc/sysconfig/network-scripts/ifcfg-eth0 and ifcfg-eth1 | |
cd /etc/sysconfig/network-scripts/ | |
cp -f ifcfg-eth0.bak ifcfg-eth0 | |
cp -f ifcfg-eth1.bak ifcfg-eth1 | |
sed -i "s/xxpublicipxx/$publicIP/g" ifcfg-eth0 | |
sed -i "s/xxprivateipxx/$privateIP/g" ifcfg-eth1 | |
service network restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment