I have two VMs(Ubuntu) in virtualbox and I wanna assign the first one and the other one But when I set network type to NAT the network adresses are different, and

Even when I change the range, one of them to another one statically in Ubunutu I can not ping another one.

I could not find any solution over the Internet!


NAT mode will not let you do that. In this mode:

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.

Note there's an isolation between each virtual machine, so they will be unable to connect to each other.

What you need is to configure your virtual machines (go to settings, network, look at the network modes) to use either internal networking or host-only networking.

Internal networking will allow virtual machines to communicate only with other virtual machines. Host-only networking will also allow VMs to communicate with the host system.

Read here about what each mode does and how to configure them:


  1. configure both your virtual machines' networks to be "Internal network". Select "eth0" for "attached to" (this means the VM's network interface that will be connected to this network) and select the same "name" for the network (think of each name as a "hub" to which virtual machines are connected). The default of intnet is fine.
  2. Boot your VMS, and manually assign IP addresses. I tried with for one and for the other.
  3. You should be able to ping from It works for me!
| improve this answer | |
  • I read the instruction that you mentioned so there is not straightforward solution, i have to use 2 NICs for my purpose. By the way thank you for your answer. – Anna Feb 6 '13 at 15:02
  • NOOOO you don't need two NICs for the VMS to talk to each other, see the updated answer. – roadmr Feb 6 '13 at 15:20

As of VirtualBox 4.3, a new mode called "NAT Network" is supported. To enable this, go to "VirtualBox preferences -> Network". Under "NAT Networks", create a new network. Then, on each guest, go to "Preferences -> Network". Under "Attached to:" select "NAT Network" and under "Name:" select the network you created earlier. Now you have one NIC that can reach the outside world and other guest on the same NAT network. Configuring static IPs worked with no problem for me but the NAT Network mode also supports DHCP. My configuration (using defaults) was Default Gateway =, Mask =, and IP(s) You may have to manually supply DNS IPs if configuring static IPs (I had to on Windows). Just use the public Google ones ( and

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.