2015-10-13 23 views
1

當我運行vagrant up時,當嘗試連接到具有insecure_private_key的VM時,我的設置掛起。它不停地嘗試,用類似這樣的輸出努力:通過SSH連接懸掛的流氓Libvirt

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 [email protected]它工作得很好。

我怎麼能夠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 

回答

0

我想通了。無論什麼負責流浪端口轉發本地主機的2222端口到遠程主機22端口不起作用。我建立了我自己的端口使用ssh這樣的:ssh -L 2222:192.168.121.24:22 127.0.0.1

其中192.168.121.24是試圖啓動一個虛擬機的IP地址。我知道IP地址,因爲我正在看日誌。然而,奇怪的是,在我銷燬了虛擬機並重新創建之後,它運行起來了。我不需要使用新VM的IP地址重新創建端口。這就像流浪者一旦看到它工作一次,它就停止檢查端口。

無論哪種方式,它現在正在工作,但只在我創建端口的終端前進。我想用iptables或firewalld可以完成更系統的端口轉發。