how to allow VMs and host ping each other?

101,564

Solution 1

Change NAT to Internal Network :

  • Select your VM
  • then press Setting
  • then Network.

Now you can see adapter attached to your VMs , to make all machine able to ping each other select Internal Network, that make a connection between all VMs , to ping the computer host select Bridge Adapter , then select the interface.

Solution 2

In case some people are interested in VirtualBox, and this is what I think:

VBoxManage.exe modifyvm vm-name --memory 1024 --nic1 nat --nic2 hostonly --hostonlyadapter2 "VirtualBox Host-Only Ethernet Adapter"

nic1 with nat is for Internet access; nic2 with hostonly is for host access; check virtual machine host name in /etc/sysconfig/network or using hostnamectl set-hostname host-name and file:

/etc/sysconfig/network-scripts/ifcfg-[interface]
DEVICE=interface
HWADDR=some string...
TYPE=Ethernet
UUID=0e5413f5-asdf-40e1-b0fb-asdfasdfasdfasdf
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.57.104
NETMASK=255.255.255.0

I configured virtual machine using virtualbox command tool, but from time to time, the generated files are corrupted, so I have to fix above files manually.

Then in the host: ensure the nic with a name "VirtualBox Host-Only Network" is configured in the same network (IP4: 192.168.57.1, NETMASK=255.255.255.0). And that "VirtualBox Host-Only Network" is created when install VirtualBox (or is it?).

please correct this if any flaw.

Share:
101,564
Alex Gordon
Author by

Alex Gordon

Updated on September 18, 2022

Comments

  • Alex Gordon
    Alex Gordon over 1 year

    I'm trying to set up a few VMs of ubuntu on my windows 7 machine. I need the machines to be able to ping each other and I would like to assign them a FQDN.

    The purpose of this project is to set up a hadoop cluster. I'm following the instructions here.

    The fully qualified domain name (FQDN) for each host in your system, and which component(s) you wish to set up on which host. The Ambari install wizard does not support using IP addresses. You can use hostname -f to check for the FQDN if you do not know it.

    I've edited /etc/hosts :

    127.0.0.1 localhost
    10.0.0.1 base.localdomain base
    

    How can I assign FQDN to each VM, and make sure the machines can see each other? I'm using virtualbox.

    I do not have DNS. My VirtualBox is set up as NAT and all defaults.

  • Alex Gordon
    Alex Gordon almost 11 years
    thanks! what settings need to be changed in /etc/hosts etc?