Page 1 of 1
VirtualBox Networking with two NIC's.
Posted: 26. May 2009, 14:23
by helboy
Hi
I am noob

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.

.
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
Re: VirtualBox Networking with two NIC's.
Posted: 26. May 2009, 14:52
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.
Re: VirtualBox Networking with two NIC's.
Posted: 27. May 2009, 07:46
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

.anyways i will surely check the configuration an see if it works for me today itself.

Re: VirtualBox Networking with two NIC's.
Posted: 27. May 2009, 10:45
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.
Re: VirtualBox Networking with two NIC's.
Posted: 27. May 2009, 15:41
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.
Re: VirtualBox Networking with two NIC's.
Posted: 28. May 2009, 08:33
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.

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?
Re: VirtualBox Networking with two NIC's.
Posted: 28. May 2009, 10:25
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?