VirtualBox Networking with two NIC's.

Discussions about using Windows guests in VirtualBox.
Post Reply
helboy
Posts: 4
Joined: 26. May 2009, 13:54
Primary OS: MS Windows 2003
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: MS Windows XP 32-bit

VirtualBox Networking with two NIC's.

Post by helboy »

Hi

I am noob 8) as far as VM's are concerned but I am learning and definitely interested in exploring it further.I have been experimenting with different VM applications for the past 3-4 months and have finally decided to adopt VirtualBox as my VM choice.Its very stable and is easy to configure too.I have tried out the following till now
1. Windows XP 32bit host with Windows XP 32bit guest,single NIC.
2.Windows 2003 64bit host,windows XP 32-bit guest,single NIC.

Recently I tried to experiment with a different setup altogether.I dont know if this has been tried before or if it is possible at all :) but i thought i will give it a try anyways.My plan is as follows
1.Run a Win XP 32-bit guest on a Win 2003 x64 / Win Vista x64 host.
2.Install two NIC's on the host,lets say NIC1 and NIC2.
3.Setup the guest OS to use the NIC2 to connect to the Internet directly through my broadband router-modem while also keeping the guest to be invisible to Host machines network.
4.I am planning to use the shared folders feature to transfer files between the Guest and Host.
5.The host machine should be able to connect to my LAN using NIC1, but NIC2 need not be visible to my Host machines LAN (if possible).
6.The guest machine need not connect to my host machines LAN.It should be explicitly connected to the internet directly through modem .i.e whatever communication to and from NIC2 should be private to the guest.

In short I need a virtual machine that can be safely used to connect to the internet without my Host having access to it.totally invisible.:D.

Well so here it is.Anybody having any idea pls guide me as to whether this is possible and if so how it is possible.

Thank you
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: VirtualBox Networking with two NIC's.

Post by Sasquatch »

I think this can be done with only one NIC too. If I understand you correctly, the whole network won't connect to the internet through the modem, but have communication only between each other, in which the VM must not take part in.
Now this can be done using separate IP subnets. This is an example you can change for your own needs. I will use only ONE NIC for this setup.

On the Host, configure the NIC connected to a switch which is also connected to the modem for internal use, let's say IP range 192.168.100.1. The rest of the network machines will have the same IP range, 192.168.100.x. This will cause them all to see each other, but not the modem or the Guest. You don't set a gateway or DNS server on this config.
The Guest will have it's IP in the range of the modem. Let's say the modem is 192.168.1.1. The Guest will be 192.168.1.4. Gateway and DNS server is the modem.

The NIC setting for the Guest VM is set to Bridged, with the physical NIC selected for use.
Now all traffic to the internet will go through the switch to the modem, then to the internet. The rest of the network will go through the switch to the machine it wants to connect to. As both networks are on the same physical connection, but are separated due to the network settings, traffic won't be seen by one another.

Now if you really want to use two nics, you have to make sure that the internet NIC on the Host doesn't get any configuration that might see the modem. That could be an entire different IP range, as in my example, or set it for auto IP and disable the DHCP on the modem. The prior option is adviced, as it will speed up your boot process, as the NIC won't have to wait for a DHCP timeout.
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.
helboy
Posts: 4
Joined: 26. May 2009, 13:54
Primary OS: MS Windows 2003
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: MS Windows XP 32-bit

Re: VirtualBox Networking with two NIC's.

Post by helboy »

Wowwww that was quick. :) I was not expecting any replies to the query so quick.probly in a ady or two but this is great.I am really impressed with the quality of the forum.Thank you very much for the quick reply Sasquatch.This forum really ROCKSS :D .anyways i will surely check the configuration an see if it works for me today itself. :D
helboy
Posts: 4
Joined: 26. May 2009, 13:54
Primary OS: MS Windows 2003
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: MS Windows XP 32-bit

Re: VirtualBox Networking with two NIC's.

Post by helboy »

OK.So i tried the suggestion by Sasquatch.but i was specifically hoping for using two NIC's.I think I'll explain it a bit more elaborately.
I have attached a jpg image along with, which shud outline my required setup.So based on the diagram here is the propsed setup

The machine "My PC" hosts the guest OS."My PC" has two NIC's installed."Proxy machine" is used to provide connectivity to the other LAN clients.

[*] Host OS on "My PC" shud be able to connect to LAN as any other LAN clients like PC1,PC2,PC3,through "NIC1" on "My PC".
[*] The proxy machine is connected to "modem" through "Switch 1".
[*] Guest OS need not connect to LAN.
[*] Guest OS shud connect to Internet through "NIC2" on "My PC" which is connected directly to the "modem" via "Switch 1".
[*] Machines on the LAN are connected to "Proxy Machine" through "Switch 2".
[*] Machines in the LAN as well as Host OS on "My PC" shud connect to internet through "Proxy Machine" only,ie., Switch 2 --> Proxy Machine --> modem.
[*] Only Guest OS need connect to modem through "Switch 1".

Hope that is clear enough.If this is configurable then I hope to create a group of machines for specific connectivity options that are different from the other machines connected to the LAN.

Thanx in advance.
Attachments
network4vm.JPG
network4vm.JPG (34.07 KiB) Viewed 2483 times
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: VirtualBox Networking with two NIC's.

Post by Sasquatch »

Does the modem allow more than one network connections, aka, is it a router? If so, then that is not a problem. Else you need to hook it to the switch. The configuration in your diagram looks sound.
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.
helboy
Posts: 4
Joined: 26. May 2009, 13:54
Primary OS: MS Windows 2003
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: MS Windows XP 32-bit

Re: VirtualBox Networking with two NIC's.

Post by helboy »

Sasquatch wrote:Does the modem allow more than one network connections, aka, is it a router? If so, then that is not a problem. Else you need to hook it to the switch. The configuration in your diagram looks sound.

Thanx for the suggestion.The modem has only one network port so I guess i shud go the switch way.And yes I am using the switch to connect both "My PC" and "Proxy machine" to the modem right now.I have disabled the NIC of the Host machine which is conencted to the switch(NIC2) as I dont need the Host OS to connect directly to the modem.My intention was to dedicate the NIC2 for explicit use by the Guest OS only.I hope my explanation is clear enough.

And that is where i am stuck.:D :oops: I am not exactly sure how to explicitly assign the said network card (NIC2)for use with my Guest in virtualbox settings so that the communication between the modem and NIC2 will be private to the Guest OS alone.I wanted to know if there was any way to do this?
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: VirtualBox Networking with two NIC's.

Post by Sasquatch »

Turning of the NIC on the Host is essentially the same as pulling the plug. The device is off, so the Guest can't use it either. Why do you think I didn't mention shutting it down?
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