更新时间:2023-10-17 10:48:52
我也遇到了同样的问题;根据您关于删除规则的提示,我发现您可以使用 VirtualBox GUI 查找规则并删除它们.
I came here with the same problem; with your hint about deleting the rule I found that you can use the VirtualBox GUI to find the rules and delete them.
当然,这只适用于您在带有 GUI 桌面的机器上工作.
Of course, this only works when you are working on a machine with a GUI desktop.
Network
并打开Port Forwarding
对话框Network
from the list on the left and open the Port Forwarding
dialogue从这里您可以直接删除规则.
From here you'll be able to directly remove the rules.
http://i.stack.imgur.com/6fQQc.png
查看规则,似乎他们只是获得了一个与正在设置的端口相同的名称.所以你也可以查看 Vagrantfile,并搜索这样的一行:
Looking at the rules, it seems they just get a name that is equal to the port being set. So you can also look at the Vagrantfile, and search for a line like this:
db.vm.network :forwarded_port, guest: 5432, host: 5432
并猜测规则的名称将是 5432
.转发 ssh 端口 22 的规则名称,称为 ssh
And guess that the name of the rule will be 5432
. The name of the rule for forwarding the ssh port 22, is called ssh
$ vboxmanage modifyvm "vbox-id" --natpf1 delete "5432"