NAT'd VMs can't talk to other NAT'd VMs

This is for discussing general topics about how to use VirtualBox.
Post Reply
mubix
Posts: 3
Joined: 9. Nov 2009, 19:51
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: ALL

NAT'd VMs can't talk to other NAT'd VMs

Post by mubix »

What it truly boils down to is I need a bunch of VMs to be able to talk to one another, and to be able to talk to the 'internet'. Is the only way to do this to set every VM up with two interfaces? One NAT and one 'internal' ?
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: NAT'd VMs can't talk to other NAT'd VMs

Post by vbox4me2 »

Or Bridge mode. or use 1 VM with a Bridge and internet networking setup with ICS, the other VM's connect to the internal network.
mubix
Posts: 3
Joined: 9. Nov 2009, 19:51
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: ALL

Re: NAT'd VMs can't talk to other NAT'd VMs

Post by mubix »

I can't use bridged in this scenario, and I was trying to not have to set up a separate VM as a NATing device, but thanks for the response.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: NAT'd VMs can't talk to other NAT'd VMs

Post by Sasquatch »

Either NAT + Internal, NAT + Host-Only or Bridged are your options.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
mubix
Posts: 3
Joined: 9. Nov 2009, 19:51
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: ALL

Re: NAT'd VMs can't talk to other NAT'd VMs

Post by mubix »

Sasquatch wrote:Either NAT + Internal, NAT + Host-Only or Bridged are your options.
Thanks!, I've looked on the main page, is there a feature request section/link that I'm just not seeing?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: NAT'd VMs can't talk to other NAT'd VMs

Post by Perryg »

You mean Suggestions ?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: NAT'd VMs can't talk to other NAT'd VMs

Post by Sasquatch »

There is one other option you can use, and that is Internet Connection Sharing on the Host using the Host-Only adapter. You have to disable the VB DHCP server and set the Host-Only adapter to 192.168.0.1 netmask 255.255.255.0. The Guests will use that IP as gateway and the Host's DNS as their own DNS. The Guests should be able to obtain an IP address automatically. This is when you're on Windows Host.
For a Linux Host, you need IPTables, some rules (just one line, another is for actual forwarding through the interfaces, modify as needed) for it and your own IP configuration that you want to use.

Code: Select all

# Enable internet sharing for VMs
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
This done on the Host. The interface eth0 is the one you have internet on. I have this in /etc/rc.local.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply