Vagrant: Remove NAT, and use public_network only. Error: A NAT rule of this name already exists

Created on 19 Nov 2014  ยท  4Comments  ยท  Source: hashicorp/vagrant

I met a web server (guest) problem related with post hash, and got the information it may be caused by NAT, so I tried to remove guest NAT and use public_network only.

Environment:

Host: Mac 10.9.5
VirtualBox version: 4.3.18
Vagrant version:  1.6.5

Vagrantfile:

config.vm.network "public_network"

After vagrant up, Virtualbox shows 2 network adaptor

Adapter 1: Intel PRO/1000 MT Desktop (NAT)
Adapter 2: Intel PRO/1000 MT Desktop (Bridged Adapter, en0: Wi-Fi (AirPort))

I shut down guest, and remove the guest's Adapter 1 in VirtualBox manually, then vagrant reload, and get the following information:

==> default: Clearing any previously set network interfaces...
==> default: Available bridged network interfaces:
1) en0: Wi-Fi (AirPort)
2) en1: Thunderbolt 1
3) en2: Thunderbolt 2
4) bridge0
5) p2p0
    default: What interface should the network bridge to? 1
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: bridged
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["modifyvm", "f06d14aa-22d4-44ed-981e-c274acbda94d", "--natpf1", "ssh,tcp,127.0.0.1,2222,,22"]

Stderr: VBoxManage: error: A NAT rule of this name already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component NATEngine, interface INATEngine, callee nsISupports
VBoxManage: error: Context: "AddRedirect(Bstr(strName).raw(), proto, Bstr(strHostIp).raw(), RTStrToUInt16(strHostPort), Bstr(strGuestIp).raw(), RTStrToUInt16(strGuestPort))" at line 1708 of file VBoxManageModifyVM.cpp

How can I remove NAT and use public_network only in vagrant?

Most helpful comment

Did it change ever since?

Vagrant requires NAT

Where can I read more about this very requirement to have NAT?

All 4 comments

For my understanding Vagrant requires a nat driver currently, i don't know if you are able to delete it at this point :)

Vagrant requires NAT, unfortunately. There is no way around this currently.

Did it change ever since?

Vagrant requires NAT

Where can I read more about this very requirement to have NAT?

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings