I noticed that if I choose a different host network in my Vagrantfile, the virtual machine will use it correctly, but vagrant will not honor it when subsequently creating the port forwarding rule.
I stumbled on this issue (https://github.com/hashicorp/vagrant/issues/10575) which revealed some files that vagrant uses. Apparently it defaults to vmnet8, and if I hand edit it and restart the mentioned process I can get it to work, but since that issue wasn’t directly related to what I’m trying to do, I just wanted to reach out to see if there’s an automated way to do this since it’s not unusual to use multiple networks within vmware.
Is there another way to tell Vagrant which host virtual network I want the virtual machine connected to so that it will create the port forward rule for that network?
VMWare can host multiple virtual networks, any one of which can be configured to NAT traffic. I’m looking for a way to choose any one of those networks. The examples given in your link suggests I’d be working with the physical interfaces on the host system? Are you saying I can use something like this: config.vm.network "public_network", bridge: vmnet2"?
Hey zestysoft,
sorry for taking so long to get back to you. Also, I seem to have misinterpreted your question.
There currently is no way to change the default device from vmnet8. Vagrant requires that the default network is NAT. Since vmnet8 is automatically created by vmware as a NAT, Vagrant will default to using it. While it may make sense to be able to choose from any of your configured NAT networks, Vagrant currently can not do that.