contiv / netplugin

Container networking for various use cases
Apache License 2.0
512 stars 177 forks source link

Make failure due to vagrant error #245

Open jojimt opened 8 years ago

jojimt commented 8 years ago

Make fails with the following error. This is perhaps because the host port is hard-coded in the Vagrantfile. As a result, another Vagrant running on the same host will cause this error. Work-around is to edit the Vagrantfile to select a different host port.

==> netplugin-node1: Setting the name of the VM: netplugin_netplugin-node1_1453386884165_4720 Vagrant cannot forward the specified ports on this VM, since they would collide with some other application that is already listening on these ports. The forwarded port to 9999 is already in use on the host machine.

To fix this, modify your current projects Vagrantfile to use another port. Example, where '1234' would be replaced by a unique host port:

config.vm.network :forwarded_port, guest: 9999, host: 1234

Sometimes, Vagrant will attempt to auto-correct this for you. In this case, Vagrant was unable to. This is usually because the guest machine is in a state which doesn't allow modifying port forwarding.

vvb commented 8 years ago

We could enable auto correction. One thing to consider if we enable auto correction, is that the user will need to use --netmaster option explicitly while running netctl. Some relevant bits from Vagrant documentation,

Port collision detection is always done. Vagrant will not allow you to define a forwarded port where the port on the host appears to be accepting traffic or connections.

Port collision auto-correction must be manually enabled for each forwarded port, since it is often surprising when it occurs and can lead the Vagrant user to think that the port was not properly forwarded. Enabling auto correct is easy:

Vagrant.configure("2") do |config|
  config.vm.network "forwarded_port", guest: 80, host: 8080,
    auto_correct: true
end

The final :auto_correct parameter set to true tells Vagrant to auto correct any collisions.