How to stop vagrant from auto-creating a NIC

341 views
Skip to first unread message

Joaquin Menchaca

unread,
Sep 13, 2015, 8:47:17 PM9/13/15
to Vagrant
My Vagrantfile has this:

  config.vm.define "client" do |client|
    client.vm.box = "hashicorp/precise64"
    client.vm.network :private_network, ip: "10.10.10.10"
  end


But then I get two NICs. I want to just have the IP I specify, and have another system (server) do the routing to Internet.

$ 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:738 errors:0 dropped:0 overruns:0 frame:0
          TX packets:539 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:85404 (85.4 KB)  TX bytes:66000 (66.0 KB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:02:75:91 
          inet addr:10.10.10.10  Bcast:10.10.10.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe02:7591/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 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:0 (0.0 B)  TX bytes:468 (468.0 B)


Alvaro Miranda Aguilera

unread,
Sep 14, 2015, 1:32:30 AM9/14/15
to vagra...@googlegroups.com
Hello,

Vagrant will always create a NAT interface on Virtualbox.

Then, your first NIC will be eth1.

You can use a script for that routing you want.

Check at the end of this page:
https://docs.vagrantup.com/v2/networking/public_network.html

Alvaro.
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in violation
> of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues: https://github.com/mitchellh/vagrant/issues
> IRC: #vagrant on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vagrant-up+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/e656b077-423b-4dca-b20b-2e718fa6e132%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages