Using vagrant 1.7.2 on OSX (MacBook Pro), Ubuntu 14.04 guests, VirtualBox 4.3.26. Mac is connected to the world via standard WiFi interface.
I want the Vagrant boxes to use the bridged network on the local LAN as their primary (and only) interface. This is required for experimenting with tcptraceroute, which doesn't do the right thing through the NAT'ed network. What I have now in my Vagrantfile is:
Vagrant.configure(2) do |config| config.vm.provider "virtualbox" config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)" config.vm.box = 'ubuntu/trusty64' end
And what I get inside the Vagrant box is:
$ ip -o -4 a 1: lo inet 127.0.0.1/8 scope host lo\ valid_lft forever preferred_lft forever 2: eth0 inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0\ valid_lft forever preferred_lft forever 3: eth1 inet 172.16.69.16/24 brd 172.16.69.255 scope global eth1\ valid_lft forever preferred_lft forever
(172.16.69/24 is my LAN address).
If I manually take down
eth0 and switch the default route to
172.16.69.1 then I can use the VirtualBox as I want to:
# ifdown eth0 Internet Systems Consortium DHCP Client 4.2.4 Copyright 2004-2012 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/eth0/08:00:27:56:a8:46 Sending on LPF/eth0/08:00:27:56:a8:46 Sending on Socket/fallback DHCPRELEASE on eth0 to 10.0.2.2 port 67 (xid=0x69745103) # route add -net default gw 172.16.69.1 # route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 172.16.69.1 0.0.0.0 UG 0 0 0 eth1 172.16.69.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
tcptraceroute works right.
My question is - how can I configure Vagrantfile to avoid bringing up the eth0 interface as a NAT'ed interface and just bring it up as a single, bridged interface?
I tried playing around with
config.vm.network "private_network" as partly explained in http://docs.vagrantup.com/v2/virtualbox/networking.html but as far as I followed all it did was to add interfaces to the box, not replace the default NAT'ed inetface on