How to set up a NAT and and a Host Only adapter using Vagrant?
6,819
You should use the :adapter
parameter to achieve what you want. Keep in mind that the adapter no. 1 is always a NAT.
config.vm.network :hostonly, "192.168.50.4", :adapter => 2
Related videos on Youtube
Author by
PunjCoder
Updated on September 18, 2022Comments
-
PunjCoder over 1 year
I am trying to make a NAT connection (for yum downloads) and a Host-Only connection (for talking with host) at the same time on my CentOS box when using Vagrant.
I CAN do it by SSHing and checking
/etc/udev/rules.d/70-persistent-net.rules
and creating corresponding/etc/sysconfig/network-scripts/ifcfg-eth1
. However I can't find anything describing how to have both a NAT and a HOST only connection in Vagrant using Vagrantfile configurations. Things to consider:- Bridged connection is NOT what I want. I'm behind a DHCP client that requires authentication.
config.vm.network :hostonly, "192.168.50.4"
overwrites the default NAT connection, so that does not work either.
Thanks in advance for sharing your know how.
-
holms almost 9 yearsthis is not for latest vagrant is it?