Jump to content

Can a saved vagrant box handle a change in ISP ?


ajoo
Go to solution Solved by gizmola,

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
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

  • Solution

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

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