Few virtual netrowk cards

This is for discussing general topics about how to use VirtualBox.
Post Reply
Don Joy
Posts: 7
Joined: 21. Jun 2010, 20:54
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP,Ubuntu,W7

Few virtual netrowk cards

Post by Don Joy »

Hi all.

I'm trying to set-up an anevironment to develop node.js on ubuntu, where one VM is a server, and the other is a client.

My host is a W7 home that came with the Dell i7 I got that runs practically nothing but VBox (and a voip clinet - only because microphone is not supported on guests).

My guest SVR is Ubuntu svr 10.x, and my client is WinXPsp3.

The SVR is "new in the family". Before that I worked with my XP set to NAT and all was great, and the big fiddle is trying to make the two communicate with each other *and* keep an internet connection on both guests - without putting them as bridged.
I cannot do that because of an anal network policy in the organization I work in, where all communication to the internet passes through a proxi that confirms only calls from the IP he assigned my host.

Internal Network alone was fine, but with no internet, host-only cannot connect to each other, and two machines on NAT for some reason conflict each other.

I even tried give each virtual machine 2 virtual cards - 1 for interna Network and 1 for NAT - that's how I found the conflict between two guests on NAT.

A seconndary issue is that the Ubuntu could not get an IPv4 are ress, only IPv6, but I currently assume that the network conflicts are the problem, and once they're out - the ubuntu will get a hold of the situation again.

Please, I need help on this, what am I missing?
Leak
Posts: 242
Joined: 31. Mar 2009, 13:00
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Debian Testing, Windows XP, Windows Server 2003/2008 R2

Re: Few virtual netrowk cards

Post by Leak »

Don Joy wrote:Please, I need help on this, what am I missing?
I can't say what's exactly missing here - but I'm running two (albeit Windows server) VMs at work that both use NAT and the internal network and it works just fine.

Of course, you'll have to set the NICs using NAT to use DHCP (or use a static address in the - I think - 10.0.2.x range) whereas the NICs on the internal network need a static IP address (unless you set up DHCP on the server VM) AND make sure it's a different subnet than the one used by VirtualBox for NAT (i.e. pretty much anything but 10.0.2.x)...

np: Autechre - Second Scepe (Anvil Vapre)
Don Joy
Posts: 7
Joined: 21. Jun 2010, 20:54
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP,Ubuntu,W7

Re: Few virtual netrowk cards

Post by Don Joy »

Interesting. Can your two servers see each other?

on my setup both VMs are configured to use DHCP.
The ubuntu is

Code: Select all

auto lo
iface lo inet dhcp

auto eth0
iface eth0 inet dhcp
And on the XP it's just that "obtain automatically" option on the IPv4 dialog properties.

When the XP runs alone - all is well. Ping, browser, svn, anything.

When ubuntu runs alone -
if config gives me the 10.0.2.15, dig works immediately, ping is running happily, apt-get is obediently fetching all my uttermost bizarre needs and all is fine.
But this server, that is a minumal installation without any gui tools is useless without clients to talk to.

So now I boot my XP guest, and all hell breaks loose :P
lease requests loop over and over, dhclient commands timeout, and all that.
Both machines have the same IP - 10.0.2.15
When I try to mannually configure one of them with IP, Mask, gatway DNS - then they have internet again, but will still not talk to each other.

That's where I thought maybe I'll give two virtual network cards for each, one NAT and one internal, but still can't get it running....

I tried disabling the windows antivirus, for no avail.

Does this sound familiar to anybody? ...help...
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: Few virtual netrowk cards

Post by Sasquatch »

Your Ubuntu config is not complete. You need a second configuration entry. Like Leak said, you need to set the second NIC to be static as there is no DHCP on it. I'm assuming here that you configured the VMs to have 2 (two) interfaces, the first set to NAT, the second set to Internal Network. Then your Ubuntu config will look like this.

Code: Select all

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
    address 192.168.43.1
    netmask 255.255.255.0
On the XP VM, you set the one attached to NAT to DHCP (as it is by default) and the one attached to Internal to the same IP range as the Ubuntu server, something like 192.168.43.3. You don't need to provide a gateway or DNS server, as there are none.

If the above still fails, then set up one of the two VMs, or install a third, to act as router and have only one of them attached to NAT, the rest is attached to internal and communicates to the router for internet.
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.
Don Joy
Posts: 7
Joined: 21. Jun 2010, 20:54
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP,Ubuntu,W7

Re: Few virtual netrowk cards

Post by Don Joy »

AHA! I got it~!!

Thank you "Leak" - you gave it to me but I was too tierd to undertand it from your leconic answer.

**edited:
Thanks "Sasquatch" too, you probbably posted your tip while I was editing my summary :)
**edit-end

What was missing on my internal-network was IP setting for both machines, ither by introducing in the internal network a dhcp service that they were configured to work with by default, or mannually set static IP settings.

And now, for dummies (and the very tierd people that just want the answer) -
here are the setting that now works

On XP "Local Area connection 2" - which is the "Adapter 1" in the VBox setting - connected to the NAT, and the card is configured to obtain IP automatically, and use DHCP, (and is getting 10.0.2.15, and internet and all).

On XP "Local Area connection 3" - which corresponds to "Adapter 2" in the VBox settings - connected to "Internal Networking", named "greatwork" ( for fun :) ), where the "Local Area Conneciton 3" is set as following:

Code: Select all

IP adress : 20.0.0.2
Subnet Mask : 255.255.255.0
Default Gateway: 20.0.0.1
Prefered DNS and Alternate DNS - take your auto-deteced DNS from >ipconfig /all
but I'm not even sure that's necessary, but yearn to just put things down and am too tierd to try another test, if a "pro" can say a word about it - it will be great.


On Ubuntu:


eth0 corresponds to "Adapter 1" in the vbox settting - configured to the NAT, using DHCP (getting 10.0.2.15 and internet and all).

Then - on the ubuntu - eth1 corresponds to "Adapter 2" in the vbox setting - configured to Internal Networking named "greatwork" - name must match (theoretically there can be several internal networks) - and the card is using static IP settings of 20.0.0.1

which summarizes on the ubunto to /etc/networks/interfaces file like

Code: Select all

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
    address 20.0.0.1
    netmask 255.255.255.0
    network 20.0.0.0
    broadcast 20.0.0.255
    gateway 20.0.0.2

Mind the default-gateway "trick" - every machine uses the other as gateway.
I'm not sure what it means, or what will happen when I'll need a third machine in the virtual network... when we'll get there - we'll find the solution and let you'all know.


One "Savepoint" note -
I got it working using static IPs.
Since the Ubuntu is a server, I guess it could also run a dhcp server that would have worked right away after some apt-get command which I'm not familiar enough with linux to try, so I'll let the experts have a word...

Thank you gentlmen, have fun, and good night :)
Leak
Posts: 242
Joined: 31. Mar 2009, 13:00
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Debian Testing, Windows XP, Windows Server 2003/2008 R2

Re: Few virtual netrowk cards

Post by Leak »

Don Joy wrote:On XP "Local Area connection 3" - which corresponds to "Adapter 2" in the VBox settings - connected to "Internal Networking", named "greatwork" ( for fun :) ), where the "Local Area Conneciton 3" is set as following:

Code: Select all

IP adress : 20.0.0.2
Subnet Mask : 255.255.255.0
Default Gateway: 20.0.0.1
Ummm... just a minor niggle - don't use 20.x.x.x for internal IP addresses, as it's a public block of IP addresses out there on the internet - so if you happen to want to access a server out on the internet that actually has that IP address you'll find it'll connect to your local network instead.

A list of private network IP ranges can be found here, those are safe to use for local networks. I'd suggest using 10.1.0.0/24 (i.e. 10.1.0.x with subnet mask 255.255.255.0) for your internal network.

np: Autechre - Drane2 (LP5)
Post Reply