Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VirtualBox guest not getting ip address assigned by Vagrantfile

Upon vagrant up, the guest box is getting assigned the wrong IP address and causing the following error:

...
...
SSH address: 127.0.0.1:2222
serverbox: SSH username: vagrant
serverbox: SSH auth method: private key
serverbox: Warning: Connection timeout. Retrying...
serverbox: Warning: Connection timeout. Retrying...
serverbox: Warning: Connection timeout. Retrying...
...

I do work at home and at the office so must always reconfigure the ip address assignment in Vagrantfile depending on where I am at because the subnets are different. (192.168.x.x versus 10.80.x.x)

This has worked fine until just yesterday. I have no idea what is causing the issues as I haven't made any adjustments.

Vagrantfile:

Vagrant.configure("2") do |config|                                                                                                                       
  config.vm.provider "virtualbox" do |vb|                                                                                                                
    vb.customize ["modifyvm", :id, "--memory", "512"]                                                                                                    
  end                                                                                                                                                    
  config.vm.network "public_network", ip: '10.80.2.144'
  #config.vm.network "public_netowrk", ip: '192.168.1.144'                                                                                        
end

...

The Vagrantfile should put my guestbox on the 10.80.x.x address but netstat shows that my box is still going up on the 192.168.x.x address. This means I am unable to work with the guestbox since it is going to an out of bounds subnet.

I've done halt and up again as well as completely rebooting my cpu and checking to make sure virtualization is on in BIOS.

I've looked here and tried this method to no avail.

I also tried vb.gui = true but my machine is running headless. Virtualbox's Preview logging screen might provide some useful information but it is so small I can't make anything out of it. If someone has any advice on how to make that larger that could probably help a lot.

UPDATE:

So my solution is an undesired solution but my workday has been torpedoed and need to move forward so I just destroyed my box and re up'ed.

Apparently, my keys became insecure. Not sure how that happened but the new box replaced my keys.

like image 507
earth2jason Avatar asked Jan 08 '15 19:01

earth2jason


People also ask

How do I assign an IP address to a VirtualBox?

Step 1: Select Global Settings from the File menu. Step 2: Select the Network item in the list on the left and then right-click on the tool icon. Step 3: The IP address for the host can now be changed in this host-only network. Step 4: After clicking on the DHCP Server tab, the DHCP server settings can be changed.

What is Vagrantfile VirtualBox?

Vagrant is an open-source tool that allows you to create, configure, and manage boxes of virtual machines through an easy to use command interface. Essentially, it is a layer of software installed between a virtualization tool (such as VirtualBox, Docker, Hyper-V) and a VM.

Which option specifies the IP of the private network given in the Vagrantfile?

The IP address can be determined by using vagrant ssh to SSH into the machine and using the appropriate command line tool to find the IP, such as ifconfig .

Where is the Vagrantfile located?

Vagrantfile in your Vagrant home directory (defaults to ~/. vagrant. d ). This lets you specify some defaults for your system user.


1 Answers

my suggestion for your issue.

Run vagrant reload and vagrant provision on that instance after you changed IP.

If not get your problem fixed, try the second one:

change public_network to private_network

config.vm.network "private_network", ip: '10.80.2.144'
#config.vm.network "private_network", ip: '192.168.1.144'  
like image 131
BMW Avatar answered Sep 18 '22 03:09

BMW