簡體   English   中英

Vagrant-Libvirt掛在SSH連接上

[英]Vagrant-Libvirt Hanging on SSH Connection

當我運行vagrant up時,嘗試使用insecure_private_key連接到VM時vagrant up我的安裝程序掛起。 它不斷嘗試並嘗試類似於以下的輸出:

 INFO retryable: Retryable exception raised: #<Errno::ECONNRESET: Connection reset by peer>
 INFO ssh: Attempting to connect to SSH...
 INFO ssh:   - Host: 192.168.121.80
 INFO ssh:   - Port: 22
 INFO ssh:   - Username: vagrant
 INFO ssh:   - Password? false
 INFO ssh:   - Key Path: ["/home/users/swalter/.vagrant.d/insecure_private_key"]
DEBUG ssh: == Net-SSH connection debug-level log START ==
DEBUG ssh: D, [2015-10-13T15:04:11.236064 #24396] DEBUG -- net.ssh.transport.session[3fa468444c28]: establishing connection to 192.168.121.80:22
D, [2015-10-13T15:04:11.236454 #24396] DEBUG -- net.ssh.transport.session[3fa468444c28]: connection established
I, [2015-10-13T15:04:11.236614 #24396]  INFO -- net.ssh.transport.server_version[3fa468444264]: negotiating protocol version
D, [2015-10-13T15:04:11.262088 #24396] DEBUG -- net.ssh.transport.server_version[3fa468444264]: remote is `SSH-2.0-OpenSSH_5.3'
D, [2015-10-13T15:04:11.262176 #24396] DEBUG -- net.ssh.transport.server_version[3fa468444264]: local is `SSH-2.0-Ruby/Net::SSH_2.9.1 x86_64-linux'
D, [2015-10-13T15:04:11.263494 #24396] DEBUG -- tcpsocket[3fa468444868]: read 840 bytes
D, [2015-10-13T15:04:11.263615 #24396] DEBUG -- tcpsocket[3fa468444868]: received packet nr 0 type 20 len 836
I, [2015-10-13T15:04:11.263706 #24396]  INFO -- net.ssh.transport.algorithms[3fa4683ed9c8]: got KEXINIT from server
I, [2015-10-13T15:04:11.263819 #24396]  INFO -- net.ssh.transport.algorithms[3fa4683ed9c8]: sending KEXINIT
D, [2015-10-13T15:04:11.264016 #24396] DEBUG -- tcpsocket[3fa468444868]: queueing packet nr 0 type 20 len 2020
D, [2015-10-13T15:04:11.264098 #24396] DEBUG -- tcpsocket[3fa468444868]: sent 2024 bytes
I, [2015-10-13T15:04:11.264130 #24396]  INFO -- net.ssh.transport.algorithms[3fa4683ed9c8]: negotiating algorithms
D, [2015-10-13T15:04:11.264253 #24396] DEBUG -- net.ssh.transport.algorithms[3fa4683ed9c8]: negotiated:
* kex: diffie-hellman-group-exchange-sha1
* host_key: ssh-rsa
* encryption_server: aes128-cbc
* encryption_client: aes128-cbc
* hmac_client: hmac-sha1
* hmac_server: hmac-sha1
* compression_client: none
* compression_server: none
* language_client:
* language_server:
D, [2015-10-13T15:04:11.264283 #24396] DEBUG -- net.ssh.transport.algorithms[3fa4683ed9c8]: exchanging keys
D, [2015-10-13T15:04:11.264478 #24396] DEBUG -- tcpsocket[3fa468444868]: queueing packet nr 1 type 34 len 20
D, [2015-10-13T15:04:11.264533 #24396] DEBUG -- tcpsocket[3fa468444868]: sent 24 bytes
D, [2015-10-13T15:04:11.265762 #24396] DEBUG -- tcpsocket[3fa468444868]: read 152 bytes
D, [2015-10-13T15:04:11.265844 #24396] DEBUG -- tcpsocket[3fa468444868]: received packet nr 1 type 31 len 148
D, [2015-10-13T15:04:11.267446 #24396] DEBUG -- tcpsocket[3fa468444868]: queueing packet nr 2 type 32 len 140
D, [2015-10-13T15:04:11.267521 #24396] DEBUG -- tcpsocket[3fa468444868]: sent 144 bytes
D, [2015-10-13T15:04:11.269986 #24396] DEBUG -- tcpsocket[3fa468444868]: read 720 bytes
D, [2015-10-13T15:04:11.270066 #24396] DEBUG -- tcpsocket[3fa468444868]: received packet nr 2 type 33 len 700
D, [2015-10-13T15:04:11.271360 #24396] DEBUG -- tcpsocket[3fa468444868]: queueing packet nr 3 type 21 len 20
D, [2015-10-13T15:04:11.271432 #24396] DEBUG -- tcpsocket[3fa468444868]: sent 24 bytes
D, [2015-10-13T15:04:11.271491 #24396] DEBUG -- tcpsocket[3fa468444868]: received packet nr 3 type 21 len 12
D, [2015-10-13T15:04:11.271752 #24396] DEBUG -- net.ssh.authentication.session[3fa468414758]: beginning authentication of `vagrant'
D, [2015-10-13T15:04:11.271858 #24396] DEBUG -- tcpsocket[3fa468444868]: queueing packet nr 4 type 5 len 28
D, [2015-10-13T15:04:11.271905 #24396] DEBUG -- tcpsocket[3fa468444868]: sent 52 bytes
D, [2015-10-13T15:04:11.311362 #24396] DEBUG -- tcpsocket[3fa468444868]: read 52 bytes
D, [2015-10-13T15:04:11.311453 #24396] DEBUG -- tcpsocket[3fa468444868]: received packet nr 4 type 6 len 28
D, [2015-10-13T15:04:11.311547 #24396] DEBUG -- net.ssh.authentication.session[3fa468414758]: trying none
D, [2015-10-13T15:04:11.311650 #24396] DEBUG -- tcpsocket[3fa468444868]: queueing packet nr 5 type 50 len 44
D, [2015-10-13T15:04:11.311709 #24396] DEBUG -- tcpsocket[3fa468444868]: sent 68 bytes
D, [2015-10-13T15:04:11.312042 #24396] DEBUG -- tcpsocket[3fa468444868]: read 84 bytes
D, [2015-10-13T15:04:11.312109 #24396] DEBUG -- tcpsocket[3fa468444868]: received packet nr 5 type 51 len 60
D, [2015-10-13T15:04:11.312177 #24396] DEBUG -- net.ssh.authentication.session[3fa468414758]: allowed methods: publickey,gssapi-keyex,gssapi-with-mic,password
D, [2015-10-13T15:04:11.312226 #24396] DEBUG -- net.ssh.authentication.methods.none[3fa46845d0d4]: none failed
D, [2015-10-13T15:04:11.312276 #24396] DEBUG -- net.ssh.authentication.session[3fa468414758]: trying publickey
D, [2015-10-13T15:04:11.312520 #24396] DEBUG -- net.ssh.authentication.agent[3fa46846971c]: connecting to ssh-agent
D, [2015-10-13T15:04:11.312672 #24396] DEBUG -- net.ssh.authentication.agent[3fa46846971c]: sending agent request 1 len 44

DEBUG ssh: == Net-SSH connection debug-level log END ==

如果我嘗試使用ip地址嘗試ssh,請打開一個新終端,然后使用ssh -i ~/.vagrant.d/insecure_private_key vagrant@192.168.121.80可以正常工作。

如何才能通過SSH實例登錄,而無法通過這個無所事事的流程?

這是我的配置文件:

Vagrant.configure("2") do |config|
config.vm.box = "centos/6"
config.ssh.insert_key = false
# Controller node
config.vm.define "vbit00" do |n|
    n.vm.network "private_network", ip: "192.168.122.10", netmask: "255.255.255.0"
    n.vm.provider :libvirt do |libvirt|
        libvirt.driver = "kvm"
        libvirt.connect_via_ssh = false
        libvirt.username = "root"
        libvirt.storage_pool_name = "default"
        libvirt.memory = 2048
    end
end

# Storage nodes
config.vm.define "vbit06" do |n|
    n.vm.network "private_network", ip: "192.168.122.20", netmask: "255.255.255.0"
    n.vm.network "private_network", ip: "192.168.123.20", netmask: "255.255.255.0"
    n.vm.provider :libvirt do |libvirt|
        libvirt.driver = "kvm"
        libvirt.connect_via_ssh = false
        libvirt.username = "root"
        libvirt.storage_pool_name = "default"
        libvirt.storage :file, :size=> '11G'
        libvirt.memory = 1024
    end
end
config.vm.define "vbit07" do |n|
    n.vm.network "private_network", ip: "192.168.122.21", netmask: "255.255.255.0"
    n.vm.network "private_network", ip: "192.168.123.21", netmask: "255.255.255.0"
    n.vm.provider :libvirt do |libvirt|
        libvirt.driver = "kvm"
        libvirt.connect_via_ssh = false
        libvirt.username = "root"
        libvirt.storage_pool_name = "default"
        libvirt.storage :file, :size=> '11G'
        libvirt.memory = 1024
    end
end

# Compute nodes
config.vm.define "vbit10" do |n|
    n.vm.network "private_network", ip: "192.168.122.30", netmask: "255.255.255.0"
    n.vm.network "private_network", ip: "192.168.123.30", netmask: "255.255.255.0"
    n.vm.provider :libvirt do |libvirt|
        libvirt.driver = "kvm"
        libvirt.connect_via_ssh = false
        libvirt.username = "root"
        libvirt.storage_pool_name = "default"
        libvirt.storage :file, :size=>"5G"
        libvirt.memory = 4096
    end
end
config.vm.define "vbit11" do |n|
    n.vm.network "private_network", ip: "192.168.122.31", netmask: "255.255.255.0"
    n.vm.network "private_network", ip: "192.168.123.31", netmask: "255.255.255.0"
    n.vm.provider :libvirt do |libvirt|
        libvirt.driver = "kvm"
        libvirt.connect_via_ssh = false
        libvirt.username = "root"
        libvirt.storage_pool_name = "default"
        libvirt.storage :file, :size=>'5G'
        libvirt.memory = 4096
    end
end
end

我想到了。 流浪者負責將本地主機的2222端口轉發到遠程主機22端口的任何操作均不起作用。 我使用ssh這樣設置自己的端口: ssh -L 2222:192.168.121.24:22 127.0.0.1

192.168.121.24是嘗試引導的VM的IP地址。 我知道IP地址,因為我正在看日志。 然而,奇怪的是,在我銷毀了該虛擬機並重新創建它之后,它開始工作了。 我不需要使用新VM的IP地址重新創建端口。 就像流浪漢看到它一次工作一樣,它就停止檢查端口向前。

無論哪種方式,它現在都可以正常工作,但僅在我創建端口的終端中有效。 我想可以使用iptables或Firewalld實現更廣泛的系統端口轉發。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM