Skip to content
/ hostsup Public

A little shell script to insert the IP address of your Hub VM into your hosts file.

Notifications You must be signed in to change notification settings

moom/hostsup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Script Name: hostsup.sh
Purpose: To save some time setting up your hosts file when you switching to a different network.
Note: You’ll be asked for password.

Please do the following:
1. Download it and put it into your home directory, eg. ~/bin
2. $cd ~/bin 
3. $chmod 600 hostsup.sh 
4. Start your VM
5. $sh hostsup.sh

Once you’ve changed your network, you need make sure your VM has got an IP address, then run:
$sh ~/bin/hostsup.sh

The following are two basic scenarios that you will need this script:
A> You didn't finish my work, and you carry your MacBook home to finish it.
	##In this scenario, you didn't log out and you still have everything running.
	1. Go to the command prompt of your Windows VM (HubVM).
	2. Type in 'ipconfig /renew' and hit enter. If it doesn't get you an IP address on your home network, do it again until you get one.
	3. Open a Terminal in you MacBook, type in 'sh ~/bin/hostsup.sh' and hit enter.
	4. Enter your login password, then your hosts file should be updated.
	5. Now your VM is connectable from your MacBook again.

B> I fnished my work at home, turned my MacBook off and go to work the next morning.
	##In this scenario, your have shutdown everything, and you have to reboot your HubVM when you got into the office.
	1. After your VM rebooted, it'll get a new REA IP network IP address.
	2. Open a Terminal in you MacBook, type in 'sh ~/bin/hostsup.sh' and hit enter.
	3. Enter your login password, then your hosts file should be updated.
	4. Now your VM is connectable from your MacBook again.

Change Log:
	1. It now supports VMWare Fusion.

**Make sure your VM got an valid IP address on the network you are on.
**The predefined name of the VM is 'HubVM', if your VM is different, please update the 'hubvm_name' variable in the script. The name of the VM is the bold string you see on the left pane of the VirtualBox application.
**For VMWare Fusion, you need update the 'home_dir' variable to your home directory, eg. '/Users/felix_wang'. 

To Do:
	1. Make use of 'hubvm_name' variable for both VirtualBox & VMWare Fusion.

About

A little shell script to insert the IP address of your Hub VM into your hosts file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages