With this Vagrantfile, you will have a Vagrant VM with three NICs. Vagrant uses eth0 for NAT'ing the guest to the outside world. (I do not know a way to override this. Vagrant is very unhappy with eth0 being the NAT interface.) eth1 and eth2 will be on separate virtual subnets available only between the host and the guest.
Last active
December 11, 2015 00:19
-
-
Save robbkidd/4515729 to your computer and use it in GitHub Desktop.
Multiple NICs in a Vagrant machine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vboxnet2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 | |
ether 0a:00:27:00:00:02 | |
inet 192.168.33.1 netmask 0xffffff00 broadcast 192.168.33.255 | |
vboxnet3: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 | |
ether 0a:00:27:00:00:03 | |
inet 10.33.33.1 netmask 0xffffff00 broadcast 10.33.33.255 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vagrant@precise64:~$ ifconfig | |
eth0 Link encap:Ethernet HWaddr 08:00:27:88:0c:a6 | |
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 | |
inet6 addr: fe80::a00:27ff:fe88:ca6/64 Scope:Link | |
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 | |
RX packets:438 errors:0 dropped:0 overruns:0 frame:0 | |
TX packets:352 errors:0 dropped:0 overruns:0 carrier:0 | |
collisions:0 txqueuelen:1000 | |
RX bytes:47045 (47.0 KB) TX bytes:40380 (40.3 KB) | |
eth1 Link encap:Ethernet HWaddr 08:00:27:5c:f7:79 | |
inet addr:192.168.33.10 Bcast:192.168.33.255 Mask:255.255.255.0 | |
inet6 addr: fe80::a00:27ff:fe5c:f779/64 Scope:Link | |
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 | |
RX packets:4 errors:0 dropped:0 overruns:0 frame:0 | |
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0 | |
collisions:0 txqueuelen:1000 | |
RX bytes:656 (656.0 B) TX bytes:578 (578.0 B) | |
eth2 Link encap:Ethernet HWaddr 08:00:27:9f:b1:3a | |
inet addr:10.33.33.10 Bcast:10.33.33.255 Mask:255.255.255.0 | |
inet6 addr: fe80::a00:27ff:fe9f:b13a/64 Scope:Link | |
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 | |
RX packets:4 errors:0 dropped:0 overruns:0 frame:0 | |
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 | |
collisions:0 txqueuelen:1000 | |
RX bytes:656 (656.0 B) TX bytes:468 (468.0 B) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant::Config.run do |config| | |
config.vm.box = "precise64" | |
config.vm.box_url = 'http://files.vagrantup.com/precise64.box' | |
# Assign this VM to a host-only network IP, allowing you to access it | |
# via the IP. Host-only networks can talk to the host machine as well as | |
# any other machines on the same network, but cannot be accessed (through this | |
# network interface) by any external networks. | |
config.vm.network :hostonly, "192.168.33.10" | |
config.vm.network :hostonly, "10.33.33.10" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment