After host PC reboot vagrant up shows port collision on any port

瘦欲@ 提交于 2019-12-11 21:27:26

问题


My host OS is Windows.

I use Vagrant with box ubuntu/trusty64

Yesterday, after the host PC was rebooted, I am experiencing a problem - port collision, when using vagrant up or vagrant reload.

I already updated vagrant to latest version, deleted all settings, all machines, created all from blank (without reinstalling OS on host machine) And the problem still persists. Whe I use port_forward, from 80 to port I want (lets call it port X) - I get an error - port collision on port X. It can be any port. For example: 8080, 12345, 43123 - it doesn't metter.

There is no much information on the internet that could help me. I found that there must be some file called nat.conf that should be cleaned. But there is no such file on my host PC.

For the moment I use a little hack. If I need a port_forward 80, 8080 Then I use:

 config.vm.usable_port_range = (8080..8080)
  forward_port = ->(guest, host = guest) do
    config.vm.network :forwarded_port,
      guest: guest,
      host: host,
      auto_correct: true
  end
forward_port[80, 8000]

It shows that there is a collision with port 8000 and uses port 8080 as auto correction (which I used before and need now) Port X here is the 8000 which can be changed to any port, and there will be collision. So, the port X is not used 100%, but collision appears on it.

Any suggessions to fix this will be appreciated.

Thank you!

来源:https://stackoverflow.com/questions/54088209/after-host-pc-reboot-vagrant-up-shows-port-collision-on-any-port

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!