Need advice. How to configure a virtual machine as router

This is for discussing general topics about how to use VirtualBox.
Post Reply
jjplaw
Posts: 2
Joined: 17. Sep 2009, 10:00
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: WinXP

Need advice. How to configure a virtual machine as router

Post by jjplaw »

(Newbie in virtual machine stuff)
I have 2 LANs in my office, LAN A and LAN B. Printers and servers located on LAN A.
My laptop is connected to LAN A via wireless and LAN B via cable.
My workstation is connected to LAN B via cable.

I need to set up a virtual machine in my laptop that acts as a router to enable my workstation to access the printers and servers on LAN A.
Need some direction and strategy on how to approach this problem.

Has anyone done a project like this before :?:
Please advise.

Someone suggested me to use pfSense on the virtual machine.
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: Need advice. How to configure a virtual machine as router

Post by Sasquatch »

The application to use on the VM is up to you, there are several pieces of software, depending on the OS you want to run on it. The outline is at least as followed, which you can use to implement it on the software you want to use.

The VM must have 2 NICs, both in Bridged mode and each to a different physical NIC (one wireless, one wired). Configure both interfaces as needed for the attached network. Configure the software you use to route traffic from the one to the other network, so two-way communication can be done.
On the workstation, set the default gateway to the VM, or add a route for the other network to go through the VM. The latter might be a better solution because of the resources on the network, like internet and all.

Now, I use a Linux host, so your route command will differ, but with the help output of the command alone (/?) you can find the right syntax for Windows.

Code: Select all

route add -net networkA subnetA dev eth0
This command will add a route to network A that goes through interface eth0. Replace "NetworkA" and "SubnetA" with the correct values of the network.
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.
jjplaw
Posts: 2
Joined: 17. Sep 2009, 10:00
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: WinXP

Re: Need advice. How to configure a virtual machine as router

Post by jjplaw »

thanks for your reply.

Is it possible to use NAT instead?
I can use Bridged mode on LAN B but not on LAN A.
LAN A has fixed IPs configured. Admin is not willing to allocate me an IP address.

I need my workstation to access only the printers and servers on LAN A. Internet and other stuff through LAN B as normal.
So i guess the latter would be the solution...
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: Need advice. How to configure a virtual machine as router

Post by Sasquatch »

Sorry, but NAT will not be usable for that. You know, with the route command, it should be possible to access the other network resources without the need of a router. As long as the networks are accessible through the same LAN adapter. If they are physically separated, it will be a bit harder. Without an IP address on the other LAN, it will be tough. I can't give you a definitive answer on how and what to do, because I don't have a clear view of the network. Maybe your network admin can help you with this.
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