2015-11-04 167 views
2

我搜索了幾天,我沒有找到任何解決方案來解決我的問題。vagrant卡住在「默認:警告:連接超時。重試...」

我敢肯定,因爲我利用VT-x此問題不是便當/ Ubuntu的14.04-I386在Windows 8.1(我想我的CPU允許使用32位的客人,但64位不C2D E7200)

我從​​克隆GitHub庫和替換config.vm.box = 'bento/ubuntu-14.04'config.vm.box = 'bento/ubuntu-14.04-i386'Vagrantfile

而且隨着vagrant up開始流浪漢,我得到這個

λ vagrant up 
Bringing machine 'default' up with 'virtualbox' provider... 
==> default: Importing base box 'bento/ubuntu-14.04-i386'... 
==> default: Matching MAC address for NAT networking... 
==> default: Checking if box 'bento/ubuntu-14.04-i386' is up to date... 
==> default: Setting the name of the VM: settler_default_1446635664316_42330 
==> default: Clearing any previously set network interfaces... 
==> default: Preparing network interfaces based on configuration... 
    default: Adapter 1: nat 
==> default: Forwarding ports... 
    default: 80 => 8000 (adapter 1) 
    default: 3306 => 33060 (adapter 1) 
    default: 5432 => 54320 (adapter 1) 
    default: 35729 => 35729 (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: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
Timed out while waiting for the machine to boot. This means that 
Vagrant was unable to communicate with the guest machine within 
the configured ("config.vm.boot_timeout" value) time period. 

If you look above, you should be able to see the error(s) that 
Vagrant had when attempting to connect to the machine. These errors 
are usually good hints as to what may be wrong. 

If you're using a custom box, make sure that networking is properly 
working and you're able to connect to the machine. It is a common 
problem that networking isn't setup properly in these boxes. 
Verify that authentication configurations are also setup properly, 
as well. 

If the box appears to be booting properly, you may want to increase 
the timeout ("config.vm.boot_timeout") value. 

vagrant ssh-config

Host default 
    HostName 127.0.0.1 
    User vagrant 
    Port 2222 
    UserKnownHostsFile /dev/null 
    StrictHostKeyChecking no 
    PasswordAuthentication no 
    IdentityFile C:/Users/Jame/.vagrant.d/insecure_private_key 
    IdentitiesOnly yes 
    LogLevel FATAL 

vagrant global-status

id  name provider state directory 
------------------------------------------------------------------------------------------ 
87ba96c default virtualbox running C:/Users/Jame/Dropbox/Private/myscript/config/settler 

The above shows information about all known Vagrant environments 
on this machine. This data is cached and may not be completely 
up-to-date. To interact with any of the machines, you can go to 
that directory and run Vagrant, or you can use the ID directly 
with Vagrant commands from any directory. For example: 
"vagrant destroy 1a2b3c4d" 

和GUI是

screenshot virtualbox

請幫幫忙,謝謝:)

+0

的情況可能是因爲VirtualBox的失敗重定向端口,儘管說 「** ==>默認:轉發端口... 默認:22 => 2222(適配器1)**' 您可能在這裏查看我的問題的完整描述[鏈接](http://stackoverflow.com/questions/36529651/virtualbox- NAT-未能對重定向-TCP-127-0-0-12222-10-0-2-1522)。 我仍然不知道如何解決重定向失敗( 請在我的帖子中放下一個註釋,如果你的成功! – WebComer

回答

1

這可能有多種原因,它的大部分是關於私人/公共密鑰。您可以按照以下步驟排除故障:

1)首先嚐試是否可以使用密碼ssh來確保它是關於密鑰的。如果你不能,那麼你應該首先找到原因,第3步也會有幫助。

2)要做的第二件事是找出哪些密鑰流浪者正在使用。 運行vagrant ssh-config和檢查IdentityFile,在你的情況下,這是由vagrant提供的默認insecure_private_key

3)現在運行vagrant ssh -- -v,它會告訴你ssh進程的細節,仔細檢查使用的私鑰。如果你看到smt。像這樣在結束時,你可以肯定的是服務器無法比擬的公鑰,這就是問題:

debug1: Authentications that can continue: publickey,password 
debug1: Next authentication method: publickey 
debug1: Trying private key: /Users/ozan/.vagrant.d/insecure_private_key 
debug1: Authentications that can continue: publickey,password 
debug1: Next authentication method: password 
[email protected]'s password: 
debug1: Authentications that can continue: publickey,password 
Permission denied, please try again. 
[email protected]'s password: 

4)ssh登錄你的客人有密碼,並檢查公鑰是確定的。您應該檢查~/.ssh目錄和/.ssh/authorized_keys文件的權限。它們必須分別爲755(drwx ------)和600(-rw -------),它們必須歸vagrant用戶所有。

5)檢查公鑰與您的私鑰是否匹配。要做到這一點從產生像ssh-keygen -f ~/.vagrant.d/insecure_private_key -y主機上的私鑰的公鑰,並將其與一個在~/.ssh/authorized_keys

同時確保密鑰是在~/.ssh/authorized_keys是在一行,如果你做的SMT比較。像複製粘貼它可能會發生,插入新行字符,這將顯然破壞公鑰。


這裏是關於流浪者和宅基地的一些注意事項,這將有助於:

通常流浪漢替換此insecure_private_key一些安全的一個,並在啓動時調整一切,或者如果config.ssh.insert_key在您的配置設置爲true停止(這是最新版本1.7.4中的默認設置)。因此,您可能會在.vagrant目錄下看到IdentityFile的一些路徑。

我的問題是,您可以定義哪個私鑰在您的Homestead.yaml中正常使用,但是由於某種原因,宅基地並不尊重自定義密鑰,而且流浪者也沒有取代不安全的密鑰。

因此,我基本上生成並複製列出爲IdentityFile的私鑰的公鑰,並將其放入authorized_keys這確實解決了問題。

固定的公共密鑰後,我意識到,流浪者取代了insecure_private_key與successfuly一些安全的一個...

+0

我跟着你的步伐,但我沒有運氣http://pastebin.com/pingEEYJ –

+0

我假設我的問題是關於我的網絡原因,當我使用gui和登錄與vagrant密碼vagrant我不能ping任何網站(google.com) 感謝幫助我:)對不起我的郎,我希望你能理解我。 T^T –

+0

是的,在第三步你會得到:'ssh_exchange_identification:由遠程主機關閉的連接你應該關注這個。這可能與你所說的網絡問題有關...... – madpoet