ajoo Posted August 15, 2017 Share Posted August 15, 2017 (edited) 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 August 15, 2017 by ajoo Quote Link to comment Share on other sites More sharing options...
gizmola Posted August 16, 2017 Share Posted August 16, 2017 What does your Vagrantfile look like? What hosts file are you changing, and why? Quote Link to comment Share on other sites More sharing options...
ajoo Posted August 16, 2017 Author Share Posted August 16, 2017 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 ! Quote Link to comment Share on other sites More sharing options...
Solution gizmola Posted August 17, 2017 Solution Share Posted August 17, 2017 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' 1 Quote Link to comment Share on other sites More sharing options...
ajoo Posted August 17, 2017 Author Share Posted August 17, 2017 Thanks Gizmola, Will try it out and revert. Thanks loads ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.