【问题标题】:Vagrant Virtualbox port fowarding: Connection reset by peerVagrant Virtualbox端口转发:对等方重置连接
【发布时间】:2018-12-22 07:13:20
【问题描述】:

我有一个在端口 9200 上运行 elasticsearch 的 virtualbox VM,我正在尝试连接到我的本地主机。但是,每次我尝试访问该端口时,都会遇到

curl -v localhost:9200
* Rebuilt URL to: localhost:9200/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9200 (#0)
> GET / HTTP/1.1
> Host: localhost:9200
> User-Agent: curl/7.54.0
> Accept: */*
> 
* Recv failure: Connection reset by peer
* stopped the pause stream!
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer

这是我的流浪文件。我不确定我需要修复什么。

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"

  config.vm.synced_folder "~/workspace", "/home/vagrant/projects"
  config.vm.provider "virtualbox" do |vb|
    vb.memory = "8096"
  end
  config.vm.network "forwarded_port", guest: 9200, host: 9200
  config.vm.network "private_network", ip: "192.168.50.4"
  config.vm.provision "file", source: "~/.ssh/id_rsa", destination: "~/.ssh/id_rsa"
  config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/id_rsa.pub"
end

这是我运行 vagrant reload 时的打印输出

==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: A newer version of the box 'ubuntu/trusty64' for provider 'virtualbox' is
==> default: available! You currently have version '20180627.0.1'. The latest is version
==> default: '20180709.0.1'. Run `vagrant box update` to update.
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 9200 (guest) => 9200 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (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: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: 
    default: Guest Additions Version: 4.3.36
    default: VirtualBox Version: 5.2
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /Users/gyeongbae.jung/Projects
    default: /home/vagrant/projects => /Users/gyeongbae.jung/workspace
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

【问题讨论】:

    标签: ssh vagrant virtualbox port portforwarding


    【解决方案1】:

    您能否发布您正在使用的 VirtualBox 的具体版本?我只能看到您使用的是 5.2,但看不到哪个补丁版本和修订版。你在什么操作系统上运行?

    这个问题似乎在之前基于 VirtualBox 和 OSX 的错误版本发生过几次:即this report

    无论如何,尝试降级到 VirtualBox 的已知良好版本,5.1.6 和 5.1.10 似乎是好的版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-19
      • 2017-11-22
      • 1970-01-01
      • 2013-09-30
      • 2023-04-03
      • 2011-03-09
      • 2016-10-12
      • 2015-08-12
      相关资源
      最近更新 更多