首页 > 解决方案 > Vagrant ssh 在成功启动主机后挂起

问题描述

下面是我的 Vagrantfile,在启动这台主机时,它卡在

  ==> sawtoothclient: Waiting for machine to boot. This may take a few minutes...
      sawtoothclient: SSH address: 127.0.0.1:2222
      sawtoothclient: SSH username: vagrant
      sawtoothclient: SSH auth method: private key

流浪重新加载没有帮助,我不想每次登录我的虚拟主机时都停止流浪。

VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    config.vm.define "sawtoothclient", primary: true do |sawtoothclient|

        sawtoothclient.vm.box = "ubuntu/xenial64"
        sawtoothclient.vm.hostname ="sawtoothclient"
        sawtoothclient.vm.network :public_network
        #fubuntuone.vm.provision :shell, :privileged => false, :path => "bootstrap_ubuntu.sh"
        sawtoothclient.vm.synced_folder "/home/feynman/Programs/SawtoothClient/", "/home/vagrant/SawtoothClient/"
        sawtoothclient.vm.provider :virtualbox do |vb|
           vb.gui = false
           vb.memory = 2048
           #vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
           #vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
        end

    end
end

我的 UFW 防火墙规则是

  To                         Action      From
  --                         ------      ----
  Anywhere                   ALLOW       192.168.1.0/24 

但是当我添加

 sudo ufw allow 22

vagrant ssh 成功了,我不明白为什么,据我了解,vagrant 一定是使用主机IP ssh 进入vagrant 主机,这已经包含在最初添加到ufw 防火墙的防火墙规则中。

 Vagrant 2.1.4

 vboxmanage -v
 output: 5.2.18r124319

标签: vagrantvagrantfile

解决方案


推荐阅读