LoginSignup
5
10

More than 5 years have passed since last update.

vagrant + centos 7 でvagrant upが止まる、ネットワーク接続できない問題への対処

Last updated at Posted at 2017-01-10

version

  • vagrant 1.9.1
  • virtualbox 5.0.30
  • centos 7.0

CASE 1. vagrant upが途中で止まる

SSH auth method: private key
Warning: Remote connection disconnect. Retrying...

この辺で処理がSTOPする、あるいはTimeoutのエラーが出る。

原因

  1. ゲスト側にインストールされているGuest Additionsのバージョンが古い
  2. あるいはGuest Additionsがインストールされていない

これ故にport forwarding, networkまわりの挙動が不安定になる。

対応

  1. $ vagrant plugin install vagrant-vbguest --> vagrant up
  2. 公式のcentos 7を使用しない。なぜならGuest Additionsがインストールされていないから。かわりに非公式のboxイメージを使う。例えば tommy-muehle/puppet-vagrant-boxes/releases/download/1.1.0/centos-7.0-x86_64.box

参考

VagrantのboxのGuest Additionsのアップデート方法

CASE 2. ホスト --> ゲストのprivate_network接続ができない

  • ping 192.168.33.10がTimeoutする
  • ifconfigしてもeth1 or enp0s3 or enp0s8192.168.xxxのアドレスがない

原因

単純にvagrantのバグ?勝手に設定が変わってしまう(初回vagrant upは大丈夫でも2回目以降は駄目が起こりうる)

対応

Vagrantfileに強制的にサービス再起動するprovision追加

Vagrantfile
config.vm.provision "shell", run: "always", inline: "systemctl restart network.service"

参考

vagrant + centos7 でprivate_networkで設定したIPに接続ができない

おわりに

めっちゃはまった…

5
10
2

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
5
10