Eddy
Eddy

Reputation: 1812

Vagrant keeps creating unwanted network interfaces

I'm creating a VM definition and I want to specify a single "private_network" on the primary interface of the box (eth0, it's Linux)

Despite having only one config.vm.network statement, I keep getting the desired network set on eth1, while eth0 is assigned an ip from a 10.0.2.0/24 subnet which I have never defined.

How can I prevent this and have my desired 192.168.x.y/24 set on eth0?

Best, Edoardo

Upvotes: 3

Views: 4623

Answers (2)

Mark Gilbert
Mark Gilbert

Reputation: 1

https://superuser.com/questions/957631/how-to-force-vagrant-to-have-a-single-bridged-network-interface

You can try to add the adapter: 1 to the config. Although I still find some problem with it. See if it will help you starts from somewhere.

Example:

config.vm.network "public_network", bridge: "Broadcom BCM5709C", adapter: "1", ip: "192.168.x.xx" You will still have the eth1 which is host-only network...

Upvotes: 0

Terry Wang
Terry Wang

Reputation: 13920

eth0 is by default used by Vagrant for NAT (VirtualBox NAT networking mode), which allow you to vagrant ssh into the box (port forwarding rules - host 2222 <=> guest 22).

That's why you have 2 NICs even though you have only 1 config.vm.network in Vagrantfile.

I don't think it can be disabled, BUT I am not 100% sure, you may want to look into vagrant source code to dig further.

Upvotes: 6

Related Questions