Unable to ping internal network created by vagrant

1,674 views
Skip to first unread message

Rajiv Jain

unread,
Aug 18, 2015, 5:09:23 PM8/18/15
to Vagrant
Hi

I have been trying to create a internal network using Vagrant with VirtualBox. My host is a MacBook Air and my guests (Ubuntu) cannot ping each other. I have tried various resources online and according to the websites that I have viewed I seem to be doing the right thing. Below is my configuration file for Vagrant:

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"
  # config.vm.provision :salt do |salt|
  # salt.minion_config = "saltstack/etc/minion"
  # salt.run_highstate = true
  # salt.install_type = "git"
  # salt.install_args = "v2014.1.0"
  # salt.verbose = true
end

config.vm.define "web" do |web|
  web.vm.box = "ubuntu/trusty64"
  web.vm.network "private_network", ip: "10.0.2.16", virtualbox_intnet: true, virtualbox__intnet: "intnet"
end

config.vm.define "db" do |db|
db.vm.box = "ubuntu/trusty64"
db.vm.network "private_network", ip: "10.0.2.17", virtualbox_intnet: true, virtualbox__intnet: "intnet"
end

 config.vm.boot_timeout = 1000
end

As you can see I have assigned both ip addresses to my machines. When using the private network option, VirtualBox default is set to host only networking. I would like internal network. So, I added the virtualbox_intnet option to true which enables internal networking. I am using 1.7.2 of vagrant and VirtualBox version is 4.3.30.

Now, I am unable to ping both of these machines from within the guests. What am I doing wrong?

I have visited the main vagrant websites and others includinghttps://forums.virtualbox.org/viewtopic.php?f=9&t=17747

Alvaro Miranda Aguilera

unread,
Aug 18, 2015, 6:22:20 PM8/18/15
to vagra...@googlegroups.com
Hello,

You need to use a new/different IP network.

By default 10.0 is already used

So try something that won't conflict with your home/office


db.vm.network "private_network", ip: "10.10.10.17"

or

db.vm.network "private_network", ip: "192.168.222.17"

Hope this helps

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/90424fec-13ca-4480-b4c6-33d2451041fa%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Rajiv Jain

unread,
Aug 19, 2015, 5:09:31 PM8/19/15
to vagra...@googlegroups.com
Hi

Thank you very much. That worked. I really appreciate that.

I have 1 one query. I believe the virtualbox__intnet: “nameofnetwork” instructs Vagrant to join/create this internal network. However, specifying a different name defaults to intnet as the name. Is this an error or am I doing something wrong?

Thanks.

Regards,
Rajiv

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 a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/gPg4YI7g1oQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0exmt3Ucx58cQwa__4kFJw9pZ0SuGxKhj9xP5Ek1pP-i6Q%40mail.gmail.com.

Rajiv Jain

unread,
Aug 19, 2015, 5:28:55 PM8/19/15
to vagra...@googlegroups.com
Hi

It works now. I was using virtualbox_intnet instead of virtualbox__intnet. However, when the machine starts up it mentions adapter 2 as intnet rather than the name specified in the configuration file. In VirtualBox GUI it shows the correct name.

Any reason for this?

Regards,
Rajiv

Alvaro Miranda Aguilera

unread,
Aug 19, 2015, 6:36:41 PM8/19/15
to vagra...@googlegroups.com
Not sure if follow.

Can you:

vagrant destroy (this will delte the vm)
vagrant up

then

VBoxManage list vms

find the uuid of the vm

VBoxManage showvminfo <uuid>
vagrant ssh vmname -c "/sbin/ifconfig -a"
Share all that in a gist with the Vagrantfile you are using

With that I can have a look :)
> https://groups.google.com/d/msgid/vagrant-up/711438E2-C5AC-4E9B-886A-D66C4B466C81%40gmail.com.

Rajiv Jain

unread,
Aug 20, 2015, 4:01:32 PM8/20/15
to vagra...@googlegroups.com
The problem is that when the guest machine starts up it logs the following:

web: Clearing any previously set forwarded ports...
==> web: Fixed port collision for 22 => 2222. Now on port 2200.
==> web: Clearing any previously set network interfaces...
==> web: Preparing network interfaces based on configuration...
    web: Adapter 1: nat
    web: Adapter 2: intnet
==> web: Forwarding ports...
    web: 22 => 2200 (adapter 1)
==> web: Booting VM...
==> web: Waiting for machine to boot. This may take a few minutes...
    web: SSH address: 127.0.0.1:2200
    web: SSH username: vagrant
    web: SSH auth method: private key

As you can see above, it mentions Adapter 2: intnet. I think it should be say intnet3, as that is the network I am connected to as shown in the Vagrantfile below.

Below are the details:

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"
  # config.vm.provision :salt do |salt|
    # salt.minion_config = "saltstack/etc/minion"
    # salt.run_highstate = true
    # salt.install_type = "git"
    # salt.install_args = "v2014.1.0"
    # salt.verbose = true
  # end

  config.vm.define "web" do |web|
    web.vm.box = "ubuntu/trusty64"
    web.vm.network "private_network", ip: "10.10.2.16", virtualbox__intnet: true, virtualbox__intnet: "intnet3"
  end

  config.vm.define "db" do |db|
    db.vm.box = "ubuntu/trusty64"
    db.vm.network "private_network", ip: "10.10.2.17", virtualbox__intnet: true, virtualbox__intnet: "intnet3"
  end
end

Name:            example_web_1440100081495_37409
Groups:          /
Guest OS:        Ubuntu (64-bit)
UUID:            2cccbbef-0952-4887-bd40-5ec7087131ce
Config file:     /Users/example/VirtualBox VMs/example_web_1440100081495_37409/example_web_1440100081495_37409.vbox
Snapshot folder: /Users/example/VirtualBox VMs/example_web_1440100081495_37409/Snapshots
Log folder:      /Users/example/VirtualBox VMs/example_web_1440100081495_37409/Logs
Hardware UUID:   2cccbbef-0952-4887-bd40-5ec7087131ce
Memory size:     512MB
Page Fusion:     off
VRAM size:       12MB
CPU exec cap:    100%
HPET:            off
Chipset:         piix3
Firmware:        BIOS
Number of CPUs:  1
PAE:             off
Long Mode:       on
Synthetic CPU:   off
CPUID overrides: None
Boot menu mode:  message and menu
Boot Device (1): HardDisk
Boot Device (2): Not Assigned
Boot Device (3): Not Assigned
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          on
Time offset:     0ms
RTC:             UTC
Hardw. virt.ext: on
Nested Paging:   on
Large Pages:     off
VT-x VPID:       on
VT-x unr. exec.: on
State:           running (since 2015-08-20T19:48:03.230000000)
Monitor count:   1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address: 
Teleporter Password: 
Tracing Enabled: off
Allow Tracing to Access VM: off
Tracing Configuration: 
Autostart Enabled: off
Autostart Delay: 0
Default Frontend: 
Storage Controller Name (0):            SATAController
Storage Controller Type (0):            IntelAhci
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  30
Storage Controller Port Count (0):      1
Storage Controller Bootable (0):        on
SATAController (0, 0): /Users/example/VirtualBox VMs/example_web_1440100081495_37409/box-disk1.vmdk (UUID: 2202666f-3bbf-4182-bdf8-2801b1c8f99e)
NIC 1:           MAC: 0800273A0B5B, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings:  MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC 1 Rule(0):   name = ssh, protocol = tcp, host ip = 127.0.0.1, host port = 2222, guest ip = , guest port = 22
NIC 2:           MAC: 080027C52000, Attachment: Internal Network 'intnet3', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
Pointing Device: PS/2 Mouse
Keyboard Device: PS/2 Keyboard
UART 1:          disabled
UART 2:          disabled
LPT 1:           disabled
LPT 2:           disabled
Audio:           disabled
Clipboard Mode:  Bidirectional
Drag'n'drop Mode: disabled
Session type:    headless
Video mode:      720x400x0 at 0,0
VRDE:            disabled
USB:             disabled
EHCI:            disabled

USB Device Filters:

<none>

Available remote USB devices:

<none>

Currently Attached USB Devices:

<none>

Bandwidth groups:  <none>

Shared folders:  

Name: 'vagrant', Host path: '/Users/example' (machine mapping), writable

VRDE Connection:    not active
Clients so far:     0

Video capturing:    not active
Capture screens:    0
Capture file:       /Users/example/VirtualBox VMs/example_web_1440100081495_37409/example_web_1440100081495_37409.webm
Capture dimensions: 1024x768
Capture rate:       512 kbps
Capture FPS:        25

Guest:

Configured memory balloon size:      0 MB
OS type:                             Linux26_64
Additions run level:                 2
Additions version:                   4.3.10_Ubuntu r93012


Guest Facilities:

Facility "VirtualBox Base Driver": active/running (last update: 2015/08/20 19:48:10 UTC)
Facility "VirtualBox System Service": active/running (last update: 2015/08/20 19:48:16 UTC)
Facility "Seamless Mode": not active (last update: 2015/08/20 19:48:10 UTC)
Facility "Graphics Mode": not active (last update: 2015/08/20 19:48:10 UTC)

vagrant ssh web -c "/sbin/ifconfig -a"
eth0      Link encap:Ethernet  HWaddr 08:00:27:3a:0b:5b  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe3a:b5b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:632 errors:0 dropped:0 overruns:0 frame:0
          TX packets:430 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:80942 (80.9 KB)  TX bytes:61087 (61.0 KB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:c5:20:00  
          inet addr:10.10.2.16  Bcast:10.10.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fec5:2000/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:648 (648.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Alvaro Miranda Aguilera

unread,
Aug 21, 2015, 4:31:30 AM8/21/15
to vagra...@googlegroups.com
On Fri, Aug 21, 2015 at 8:03 AM, Rajiv Jain <rajivpri...@gmail.com> wrote:
> NIC 2: MAC: 080027C52000, Attachment: Internal Network 'intnet3'


Hello, Thanks the information.

I think It's working, since the output of VBoxManage showvminfo list
that as correct:

NIC 2: MAC: 080027C52000, Attachment: Internal Network 'intnet3'

So maybe it's the UI information in the console that is not telling you this?

in Vagrant you have the information, and you can see it's working.

I think the output is telling you that adapter is nat/intnet/<someother>

and not what intnet is being used.

Alvaro.
Reply all
Reply to author
Forward
0 new messages