Jump to content

Can a saved vagrant box handle a change in ISP ?


ajoo

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 !

Link to comment
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 !

Link to comment
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'

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.