# Unable to ping 2 vms hosts under vagrant

**URL:** <https://discuss.hashicorp.com/t/unable-to-ping-2-vms-hosts-under-vagrant/41224>\
**Category:** Vagrant\
**Created:** [June 26, 2022, 10:09am UTC](https://discuss.hashicorp.com/t/unable-to-ping-2-vms-hosts-under-vagrant/41224 "2022-06-26T10:09:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eoflooptot0](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/eoflooptot0/32/28999_2.png) [@eoflooptot0](https://discuss.hashicorp.com/u/eoflooptot0)\
**Post date:** [June 26, 2022, 10:09am UTC](https://discuss.hashicorp.com/t/unable-to-ping-2-vms-hosts-under-vagrant/41224/1 "2022-06-26T10:09:05Z")

</div>

Hi all,  
I was wondering if anyone could help me with an issue I am having.

I created two windows vagrant vms (vagrant is using virtualbox as a provider), vm1 , vm2 in different folders.

I want to create a local private network between the vm1 and the vm2 so in the configuration file i added this section :

for vm1 :

`config.vm.network "private_network", ip: "192.168.15.10"`

for vm2 :

`config.vm.network "private_network", ip: "192.168.15.11"`

so , when I tried to ping each vm from one to the other, i am not getting any reply from the pinged machine.

Here is one example:

```auto
cd vm1

vagrant ssh

ping 192.168.15.11

```

i got no reply from the vm2 and it is the same for the vm2 , i got no reply from the vm1.

so please if anyone can help me in fixing that it will be handy. i need vm1 and vm2 in the same network (so i would like to be able to ping between vm1 and vm2) please. Any little info will help.

Regards,  
Toto

---

<div class="post-metadata">

**Author:** ![yptk.jember](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/yptk.jember/32/24709_2.png) [@yptk.jember](https://discuss.hashicorp.com/u/yptk.jember)\
**Post date:** [June 27, 2022, 8:34am UTC](https://discuss.hashicorp.com/t/unable-to-ping-2-vms-hosts-under-vagrant/41224/2 "2022-06-27T08:34:34Z")

</div>

I use virtualbox in Fedora Linux 36, and tried to setup like your setup vagrant vm in different folder and with ip private network. and is working well and normal, my vagrant vm centos1 can ping vm centos2, and vice versa. look at my SS below

 ![Cuplikan layar dari 2022-06-27 15-28-10](https://global.discourse-cdn.com/hashicorp/original/3X/a/7/a7621631cd15bb76952bb8a65cc88c1d46dd3d00.png)

---

<div class="post-metadata">

**Author:** ![eoflooptot0](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/eoflooptot0/32/28999_2.png) [@eoflooptot0](https://discuss.hashicorp.com/u/eoflooptot0)\
**Post date:** [June 27, 2022, 10:24am UTC](https://discuss.hashicorp.com/t/unable-to-ping-2-vms-hosts-under-vagrant/41224/3 "2022-06-27T10:24:32Z")

</div>

> [@eoflooptot0](#):
>
> I created two windows vagrant vms (vagrant is using virtualbox as a provider), vm1 , vm2 in different folders.
> 
> I want to create a local private network between the vm1 and the vm2 so in the configuration file i added this section :
> 
> for vm1 :
> 
> `config.vm.network "private_network", ip: "192.168.15.10"`
> 
> for vm2 :
> 
> `config.vm.network "private_network", ip: "192.168.15.11"`
> 
> so , when I tried to ping each vm from one to the other, i am not getting any reply from the pinged machine.
> 
> Here is one example:
> 
> ```auto
> cd vm1
> 
> vagrant ssh
> 
> ping 192.168.15.11
> 
> ```
> 
> i got no reply from the vm2 and it is the same for the vm2 , i got no reply from the vm1.
> 
> so please if anyone can help me in fixing that it will be handy. i need vm1 and vm2 in the same network (so i would like to be able to ping between vm1 and vm2) please. Any little info will help.
> 
> Regards,  
> Toto

Hi mate,  
thanks again. could you share you vagrant configuration files for the 2 vms please?  
We tried again yesterday to put everything under a single file but for some reason the private ip addresses we set up don’t get created. Maybe if you have a chance you can look it up with us?

---

<div class="post-metadata">

**Author:** ![yptk.jember](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/yptk.jember/32/24709_2.png) [@yptk.jember](https://discuss.hashicorp.com/u/yptk.jember)\
**Post date:** [June 27, 2022, 1:18pm UTC](https://discuss.hashicorp.com/t/unable-to-ping-2-vms-hosts-under-vagrant/41224/4 "2022-06-27T13:18:08Z")

</div>

My Vagrantfile is default like default everybody run vagrant init in the terminal. I just uncomment private network and change same with your private network in vagrant. But did you know if virtualbox only allow private ip address in range 192.168.56.0/26? if you don’t know you can read this official article form virtualbox for networking in host only network.

[https://www.virtualbox.org/manual/ch06.html#network\_hostonly](https://www.virtualbox.org/manual/ch06.html#network_hostonly)

If in /etc/vbox/networks.conf doesn’t exist, you can create one sudo vim /etc/vbox/networks.conf then your desired ip private network example:

- 192.168.15.0/24

save and exit

restart virtualbox  
sudo systemctl restart vboxdrv.service

then try to run vagrant up --provider=virtualbox or vagrant reload

This is my private network ip configuration in vagrantfile, Look my SS below

 ![Cuplikan layar dari 2022-06-27 19-58-00](https://global.discourse-cdn.com/hashicorp/original/3X/c/6/c604bafa5cb99ed5e6f1cdcb2d3c552f839c4ba9.png)

Did you know vagrant can use all kind of type available network like you use virtualbox as guest VM? vagrant can use host only networking, bridge networking and NAT networking which is use port forwarding in vagrant.  
if you want use bridge network in vagrant virtual box you can use this:  
config.vm.network “public\_network”, :bridge =\> ‘br0’, :dev =\> ‘br0’, ip: “192.168.1.10”  
br0 is your bridge network in your host OS. So if you vagrant up or reload you can access your vagrant vm with virtualbox provier from other host/computer/laptop in the same network or LAN.
