0
votes

I've initialized a standard vagrant (no additional config just default) with ubuntu/trusty64 box. Vagrant freezes on default: SSH auth method: private key step. I thought it was a ssh problem and tried using username password and etc.

Eventually I found out that the ports are not being forwarded properly. By default port 2222 on host is forwarded to 22 on the guest machine. I can use virtualbox gui to login to the machine and see that the guest is indeed listening on port 22:

enter image description here

However the host does not have the port 2222 open. If I run netstat -na |grep 2222 on my host machine I get no result (windows 7 host with cygwin).

Additionally if I do telnet localhost 2222 I get Could not open connection to the host, on port 2222: Connect failed which indicates the port is not open

EXTRA: I have been looking for solution for over 16 hours now but no luck. Tried many different solutions and even managed to ssh into the machine by using public bridged network and static ips however the vagrant-ssh didn't work in that case and refused to map the default network drives. My conclusion is that vagrant cannot communicate with the guest machine at all once it's booted up.

EDIT Also I get surprising result when I run nmap scan on port 2222

enter image description here enter image description here

I get both of those result. If I keep running the scan, it'll return either of them randomly

1
What's the version of Vagrant and VirtualBox?MacK
Virtualbox is at the latest version, I reinstalled it again today 5.0.22 r108 108 and vagrant is 1.8.1Arijoon
You can quick-check if the port forwarding is actually active by opening VirtualBox, going into the Settings of the vm -> Network -> Adapter 1 (NAT) -> Port forwarding. A netstat command inside the VM won't never show the portforwarding (since it's on the host system, not on the guest), if you have a 22 open means the machine is listening correctly. What you can do is to check if VirtualBox has a proper port redirect active, and if not create one manually.MacK
Additionally all the stuff Vagrant needs in order to run properly (along with the SSH keypairing) sits inside a .vagrant folder. Make sure you're working inside a path which doesn't require Administrator priviledges, Example: C:\Users\<yourname> is good, while C:\Program Files is not. It might sound stupid but sometimes a vagrant destroy vagrant box update might help to get things running fresh again, especially on a Windows host.MacK
Thanks MacK, I have checked the Virtualbox portforwarding section, It has the correct mappings. I ran the netstat also on my host machine. port 2222 on host should be accessible (to route to the guest) but it isn't. Is there any way to assure the ports are forwarded correctly. I have tried a lot of solutions but it really seems like vagrant just can't communicate to the guest machine at allArijoon

1 Answers

1
votes

The issue was with Virtualbox and not vagrant. Virtual box only allows signed dll's into the guest system (check virtualbox log files to find such issues). I had Killer N wireless card with BFLLR.dll. That file is not signed (probably Bigfoot Networks is too lazy to sign their own libraries, last time I'm buying anything from them).

Removing that file fixes the issue but then you also need the driver. That library is attached to the management software of the wireless card. Remove the management software and reinstall the driver only. That should fix this issue.

I didn't look into this but there might also be a way to sign the dll and add your key to the local trusted ones (highly doubt it's easy but might be something to explore)