Jump to content
Sign in to follow this  
ajoo

Can a saved vagrant box handle a change in ISP ?

Recommended Posts

Hi all, 

 

I have different internet service providers at home and at work. At home I use my cell phone's hotspot while at office I use a broadband. The vagrant box that I save at work, then needs to be halted and restarted or reloaded when I use the box using my cell phone's hotspot.

 

This works fine but is irritable since I then need to make changes to the hosts file since a new ip is generated each time. I also need to make changes to my recaptcha settings in the google account. As this is a daily thing, it is a real drag since restarting vagrant takes a long time and at times requires many "vagrant up" commands before it finally starts successfully.

 

I was wondering if there is some method by which this can be handled automatically so that I don't reed to "vagrant reload" each time and then make changes to IP addresses at various places. 

 

Thanks loads !

Edited by ajoo

Share this post


Link to post
Share on other sites

What does your Vagrantfile look like?

 

What hosts file are you changing, and why?

Share this post


Link to post
Share on other sites

Hi Gizmola !

 

Thanks for the response.

 

Here's my Vagrant file. 


Vagrant.configure("2") do |config|
  config.vm.box = "box-cutter/ubuntu1404-i386"

  config.vm.network "public_network", ip: "192.168.2.10"
  
	# Vagrant v2.0+
		config.vm.synced_folder ".", "/vagrant", 
		owner: "vagrant",
		group: "www-data",
		mount_options: ["dmode=775,fmode=664"]			

In have, since I asked this question, added a static ip. But that too changes for different service providers. ( like when i connect from my broadband modem and from my cellphone)

 

The hosts file is the file at the loaction :- c:/windows/system32/drivers/etc/hosts. It is the file that maps the static ip of the guest VM to a local website like example.dev to be accessible from the host machine.

 

Thanks !

Share this post


Link to post
Share on other sites

What you want to do is change your network from public_network to "private_network". This will used the Nat adapter.

 

Make sure the network is something that is unlikely to conflict with your home or work network. Something like '192.168.77.x'

  • Like 1

Share this post


Link to post
Share on other sites

Thanks Gizmola, 

 

Will try it out and revert. 

 

Thanks loads !

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.