Switch IP adresses easily in hosts file. Useful when your VM changes IP address when you change location for instance.
None, it's just a plain shell script to execute.
-
Edit the list of "locations" and "IP addresses" in the
switchhost.shfile -
Make a copy of
hosts-template-exampleand rename ithosts-template(Keephosts-templateandswitchhost.shin the same folder) -
List the hosts you want to be dynamic in the
hosts-templatefile -
Change the value of the variable
hostpathinswitchhost.shif your hosts file is not located in/etc -
Set permissions on the script :
chmod u+x switchhost.sh -
Execute the script and select your location :
sudo ./switchhost