9

Host OS: Ubuntu 13.04 VMM: Virtualbox

Guest OS1: Kali Linux Network Setting: Adapter 1 attached to NAT

Guest OS2: Windows XP Network Setting: Adapter 1 attached to NAT

Issue: can't ping between guest OS.

When i checked the IP, both the guest machines have same IP address, howz that possible..? What is the required network setting i have to apply in guest OS for networking the guest os together(ping guest1 from guest2 and vice versa)

6 Answers 6

11

Choose Bridged Adapter for the connection of all VMs; the Windows VM will come up connected, while in Kali, after booting, issue the commands

   ifconfig eth0 up
   dhclient eth0

That's all.

Edit:

The above works if the host is connected to a LAN, because both VMs will then get the necessary information (IP address, router's IP address, DNSs) from the LAN router.

If the host is not connected, you will need Host only network. Before configuring this in a VM, you must go to the panel File -> Preferences -> Network, select Host only Networks, click on the Plus sign, then the screwdriver. Under Adapter, choose:

  Ip address 192.168.56.1
  IPv4 Network Mask: 255.255.255.0

Then go to DHCP server, and choose:

  Enable Server (tick!)
  IP address 192.168.56.254
  Server Mask 255.255.255.0
  Lower Bound 192.168.56.100
  Upper Bound 192.168.56.200

Save, then go to your VM panel, choose for the Network adapter Host only. There is no need to configure the Advanced Options. Start your two VMs; Windows will already be connected, for Kali you will need to issue the same two commands as above, i.e.:

  ifconfig eth0 up
  dhclient eth0

At this point you will be connected to the Host; the host will be 192.168.56.1, and the two VMs 192.168.56.100 and 192.168.56.101 (which is which, between Windows and Kali, depends on which comes up first).

Just in case: you may also have two or more adapters on each VM, so that you can have simultaneously the Bridged adapter (or NAT) that connects you to the world, and the Host-Only adapter that connects to the host and to the other VMs. This however requires that you learn how to handle several connected adapters on Windows and Linux. It is not difficult, but it does require you to do some work.

8
  • I gave Bridged adapter for both the VM and I choose eth0 for both Bridged adapter.Right now my Host machine is not connected to any network.The windows VM came up but the Kali VM shows network disconnected..Is it may be coz the host network is down.?
    – nkg
    Feb 2, 2014 at 19:31
  • @Nikhil It's due to the fact that the host machine is not connected. What I wrote works only in this case, because bridged adapter means the VMs will get IP address, gateway address and DNSs from your home router. If you want to connect them when the host is not connected, just le me know, I'll show you how. Feb 2, 2014 at 19:49
  • Thanks for the reply Marius, can you tel me how to connect between two VM when is host is not connected..? I'm actually doing an academic project which wants me to run an exploit from metasploit framework in Kali VM with Win XP VM as target..So i just need both VM's connected..
    – nkg
    Feb 2, 2014 at 19:54
  • @Nikhil Please see the edit to my post Feb 2, 2014 at 20:16
  • Hi Marius, In the Network->Adapter 1 I selected 'Attached to:Host-Only Adapter' but in 'Name' field below it shows 'Not Selected', i have no items to select there, show it shows invalid settings...can't save it
    – nkg
    Feb 3, 2014 at 5:16
5

Source Network Address Translation (NAT):

The "router", in this case, is the VirtualBox networking engine, which maps traffic from and to the virtual machine transparently. In VirtualBox this router is placed between each virtual machine and the host. This separation maximizes security since by default virtual machines cannot talk to each other.

If you are running a version greater than Virtualbox 4.3.0 (source) you can use the new NAT network option in the network dropdown. Networking improvements: A new Network Address Translation (NAT) option allows virtual machines to talk to each other on the same host, and communicate with the outside world

For earlier versions, internal network or host-only network is your choice. If you don't mind your VMs to be on the same physical network your host is connected to then you can use bridged adapter too.

4
  • Hi, I put both on internal network and gave ip Win VM as 192.168.1.10 and in kali VM as 192.168.1.20, additionally i had to give gateway IP also in Kali VM to save the setting for which i gave the same IP 192.168.1.20. Now i refreshed the connections in both the VMs..Now also both can;t ping each other
    – nkg
    Feb 2, 2014 at 19:49
  • Use the IP address of each other as the gateway. So on Win VM use 192.168.1.20 as the gateway and on Kali use 192.168.1.10 as the gateway. See if you can ping then.
    – balwa
    Feb 2, 2014 at 19:56
  • Still no luck....
    – nkg
    Feb 2, 2014 at 20:03
  • I tried the same configuration in my VB. That seemed to work just fine. So the only thing that I can think of is Cable connected checked? And for kali your interfaces looks like: iface eth0 inet static address 192.168.1.20 netmask 255.255.255.0 gateway 192.168.1.10
    – balwa
    Feb 2, 2014 at 20:26
2

You need to configure TWO network interfaces. First, Host-only, so that the VMs could talk to the Host (the VM IP address will be 192.168.56.). Second one, a bridged connection. This will allow you to connect the VM to the external world, as well as to each other, irrespective of whether they are on the same or different hosts. This will have an IP address something like 192.168.1.. You must use this second IP for your pings or Telnets etc, which will allow you to connect the VMs to each other.

1

When you use NAT with Virtualbox each machine is on its own virtual subnet and gets its IP-address from the built-in DHCP-server in the VirtualBox. Those networks have nothing in common.

If you want to be able to let them reach each other use Bridged Mode instead. Be aware that now both VMs will be part of your "outer" network - they will get their IP-addresses from your router.

In Bridged Mode you must tell VirtualBox to which real adapter the virtual adapter should be bridged (use the same for both) and without an external DHCP-server the VMs will get no IP-addresses - you can choose fixed ones (use the same network address (not host address) you use on eth0)

You will probably have to refresh the network connection within each guest.

1
  • I gave Bridged adapter for both the VM and I choose eth0 for both Bridged adapter.Right now my Host machine is not connected to any network.The windows VM came up but the Kali VM shows network disconnected..Is it may be coz the host network is down.?
    – nkg
    Feb 2, 2014 at 19:50
0

Change the network configuration of both VMs on host.

From: Internal network To: Bridged network

I already have disabled the firewall of both VM and also set a fixed Internal up address inside ipv4 network protocol.

0

This came up as top solution when I Googled the issue, thought I would put what I found was the issue with mine.

I had created a basic server install and cloned it a few times to make building my other virtual servers quicker. Doing this did not change the network adaptors MAC address. So all my virtuals had the same MAC.

To do this yourself go to Settings > Network > Advanced > and there is a 'refresh' option next to the MAC address section that you just need to press (VM needs to be off or the option is greyed out) to generate a new random MAC.

Solved the problem for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .