Page 1 of 1

VirtualBox + Vagrant + Homestead + VPN = SSH issue

Posted: 3. Feb 2015, 06:57
by jrean
Hi everybody,

The blocking problem is the following:
When I homestead up or vagrant up and I try to connect trough SSH it takes a while to connect then each keystroke is interpreted with a minimum delay of 2 minutes each making it absolutely unusable...
The configuration is the following:
  • Os X 10.10.2
  • VirtualBox 4.3.20
  • Vagrant 1.7.2
  • laravel/homestead (virtualbox, 0.2.2)
I did some tests and I found a path to explore:
I use a VPN which is configured with Viscosity (1.0 / last update) (all traffic is sent over VPN connection). I'm also using Little Snitch 3.5.1. Both are perfectly working and seems to be pretty much well configured. I'm connected over Wifi. I use Little Snitch profiles to create a kind of global Kill Switch when the VPN is not connected. So if Wifi is enabled and connected AND VPN is not connected, Little Snitch is blocking any outgoing/incoming connection (excepting some special rules) to avoid the grey zone and any leaks...
I discovered:
  • If Wifi is enabled and VPN is connected the SSH issue(s) appears.
  • If Wifi is enabled and VPN is NOT connected the SSH issue(s) disappears. (no issues, normal behaviour)
The path:
I'm pretty sure I need to set (properly) VirtualBox Network Settings. I'm not at all an expert and I would appreciate some kind help.
Here are some logs:

(Default) Homestead / Settings / Network
  • Adaptater 1 is NAT
  • Adaptater 2 is Host-Only Adaptater
  • (Kill Switch active) Wifi enabled + VPN disabled
I am aware that no internet connection is available since Little Snitch deny anything.
homestead up / vagrant up outputs the following:

Code: Select all

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: There was a problem while downloading the metadata for your box
==> default: to check for updates. This is not an error, since it is usually due
==> default: to temporary network problems. This is just a warning. The problem
==> default: encountered was:
==> default:
==> default: Failed to connect to xx.xxx.xx.xxx: Host is down
==> default:
==> default: If you want to check for box updates, verify your network connection
==> default: is valid and try again.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 80 => 8000 (adapter 1)
    default: 443 => 44300 (adapter 1)
    default: 3306 => 33060 (adapter 1)
    default: 5432 => 54320 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /Users/xxx/.composer/vendor/laravel/homestead
    default: /home/vagrant/code => /Volumes/xxx/code
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
Then if I perform homestead ssh it outputs:

Code: Select all

Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-30-generic x86_64)

 * Documentation:  xx

  System information as of Mon Feb  2 07:36:04 UTC 2015

  System load:  0.66              Processes:           103
  Usage of /:   5.0% of 39.34GB   Users logged in:     0
  Memory usage: 29%               IP address for eth0: xx.x.x.xx
  Swap usage:   0%                IP address for eth1: xxx.xxx.xx.xx

  Graph this data and manage this system at:
    xx

  Get cloud support with Ubuntu Advantage Cloud Guest:
    xx


Last login: Mon Feb  2 06:46:17 2015 from xx.x.x.x
vagrant@homestead:~$
So we can consider it's working correctly (booting in few seconds).

Wifi enabled + VPN enabled

Internet connection is available.

homestead up outputs the following:

Code: Select all

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 80 => 8000 (adapter 1)
    default: 443 => 44300 (adapter 1)
    default: 3306 => 33060 (adapter 1)
    default: 5432 => 54320 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /Users/xxx/.composer/vendor/laravel/homestead
    default: /home/vagrant/code => /Volumes/xxx/code
Guest-specific operations were attempted on a machine that is not
ready for guest communication. This should not happen and a bug
should be reported.
I want to highlight the following code:

Code: Select all

Guest-specific operations were attempted on a machine that is not
ready for guest communication. This should not happen and a bug
should be reported.
Then performing homestead ssh takes ages (at least 3 to 4 minutes) to connect with the following output:

Code: Select all

Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-30-generic x86_64)

 * Documentation:  xx

  System information as of Mon Feb  2 07:50:06 UTC 2015

  System load:  0.74              Processes:           103
  Usage of /:   5.0% of 39.34GB   Users logged in:     0
  Memory usage: 29%               IP address for eth0: xx.x.x.xx
  Swap usage:   0%                IP address for eth1: xxx.xxx.xx.xx

  Graph this data and manage this system at:
    xx

  Get cloud support with Ubuntu Advantage Cloud Guest:
    xx


Last login: Mon Feb  2 07:41:53 2015 from xx.x.x.x
vagrant@homestead:~$
At this point, it is absolutely unusable because pressing any keystroke will take minutes to resolve.

I'm pretty sure the problem comes from a bad configuration from Virtualbox / Settings / Network / Adaptater.

The connection path seems to be: host machine -> VPN server -> host machine -> VM

I would like it to be: host machine -> VM because when working on my code and with the VM, I still want to use internet on my host machine as normally (trough my VPN).
When VPN is enabled, VM external IP = VPN IP:
When VPN is disabled, VM external IP = ISP IP:
Thank you in advance for your help.

Re: VirtualBox + Vagrant + Homestead + VPN = SSH issue

Posted: 3. Feb 2015, 07:30
by socratis
Unfortunately, vagrant is not supported in these forums. You'll have to ask them.

Re: VirtualBox + Vagrant + Homestead + VPN = SSH issue

Posted: 3. Feb 2015, 07:38
by jrean
Hi,

Thank you for your "quick" answer.

It is not a Vagrant issue, I'm asking help on how to properly set Network Adapter(s) with the VirtualBox!
Please read carefully the description I provided.

Regards.

Re: VirtualBox + Vagrant + Homestead + VPN = SSH issue

Posted: 3. Feb 2015, 07:46
by socratis
I'm sorry, but I don't see a clear question that involves setting up Network Adapters with VirtualBox. I must have missed it? Can you please repeat the question briefly?

Re: VirtualBox + Vagrant + Homestead + VPN = SSH issue

Posted: 3. Feb 2015, 08:06
by jrean
My fault Socratis, you are right!

So, my Wifi is enabled and connected. My VPN is connected.

I start my box, I SSH into my box.

The connection is awful, pressing any keystroke take a least 2 to 3 minutes to resolve..
If I turn off the VPN it works as expected.

My question is:

What should I (properly) configure to make my SSH connection working properly when my VPN is enabled on my HOST?
How to avoid "host machine -> VPN server -> host machine -> VM"?
How to get things working normally with a VPN on my HOST (I need that VPN enabled on my HOST)?

Thank you :)

Re: VirtualBox + Vagrant + Homestead + VPN = SSH issue

Posted: 3. Feb 2015, 11:31
by mpack
I'm afraid we need more than your assertion that Vagrant isn't causing this. If you want support here, you need to be (duh) using the version which we support.

Re: VirtualBox + Vagrant + Homestead + VPN = SSH issue

Posted: 3. Feb 2015, 13:00
by jrean
Ok,

A bit rude.
(Because I don't have your experience neither your level)

Thank you to both of you.
I followed socratis advise and posted something on Vagrant support to ask for help.
I will see if have a feedback.

Regards.

Re: VirtualBox + Vagrant + Homestead + VPN = SSH issue

Posted: 3. Feb 2015, 14:11
by mpack
There was no rudeness intended, I was simply trying to make the situation clear. The "duh" was a joke, intended to emphasise the point. You are welcome to stick around here, but we do expect people using this site to be talking about the official version, and not one of the forks that we can't be sure we know anything about.