LoginSignup
0
0

More than 3 years have passed since last update.

VPN接続状態でVagrantを起動すると共有フォルダのマウントに失敗する

Last updated at Posted at 2019-04-17

概要

Laravelで開発してたら、急にローカルで立ち上げてるサイトが開かなくなりました。
ずっとぐるぐるしてます。
スクリーンショット 2019-04-17 10.44.54.png

試しにVagrantをリロードしてみると、共有フォルダのマウントのところでタイムアウトします。

$ vagrant reload

==> homestead-7: Attempting graceful shutdown of VM...
==> homestead-7: Checking if box 'laravel/homestead' version '7.1.0' is up to date...
#(省略)
==> homestead-7: Exporting NFS shared folders...
==> homestead-7: Preparing to edit /etc/exports. Administrator privileges will be required...
Password:
==> homestead-7: Mounting NFS shared folders...

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -o vers=3,udp,actimeo=1,nolock 192.168.10.1:/Users/kurogi-kurumi/code /home/vagrant/code
Stdout from the command:
Stderr from the command:
mount.nfs: Connection timed out

$ vagrant statusで確認すると、Vagrant自体は起動している状態です。

原因

VPN接続またはファイアウォールにより、セキュリティがかかっている。

解決策

VPNを切断またはファイアウォールを許可(または無効)します。
私の場合はVPNに使用していたCisco AnyConnectのソフトを終了しました。
スクリーンショット 2019-04-17 10.28.33.png
その後、PCを再起動します。
PC再起動しなくても仮想マシンのネットワークの再起動を行えば解決するようです。

$ ifconfig

でPCのネットワーク一覧を確認します。
私の場合はvboxnet0vboxnet1を再起動しました。

$ sudo ifconfig vboxnet0 down
$ sudo ifconfig vboxnet0 up
$ sudo ifconfig vboxnet1 down
$ sudo ifconfig vboxnet1 up

参考
https://serima.co/blog/?p=469
https://github.com/hashicorp/vagrant/issues/5802

最後に

あくまで原因&解決策の一つなのでご了承ください。
他にも$ sudo nfsd restartでNFSを再起動して直る場合もあるみたいです。
記事に間違いや不明な点があれば遠慮なくご指摘ください。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0