Configuring Virtual Network & Local Network To Have Accesss To Each Others Clients

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Turbo1982
Posts: 3
Joined: 20. Sep 2022, 19:28

Configuring Virtual Network & Local Network To Have Accesss To Each Others Clients

Post by Turbo1982 »

I would like to know if there is away to configure Virtual Box so that I can have two separate networks. Network #1 would be my physical network within my office, Network #2 would be virtual network. My physical network in my office would use my Netgear router and the virtual network would use OpenVRT or Pfswense as its router. My goal is to be able to have client’s on network #1 access clients on network #2 and vice versus. I do have two physical network cards in my Windows 10 host PC. I believe that what I am trying to do is the same as building a trust between the 2 networks so that they can access each other.
Any Assistance Would be greatly approached
BillG
Volunteer
Posts: 5102
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Configuring Virtual Network & Local Network To Have Accesss To Each Others Clients

Post by BillG »

Exactly the same way as you would connect two physical networks. The network protocols work exactly the same way in any device which uses TCP/IP. It can be a physical PC, a virtual PC or anything really.

From a networking point of view, your problem will be that the physical network uses an existing router as its gateway. You will need to modify this router to bounce traffic for your virtual network back to your internal router.
Bill
Turbo1982
Posts: 3
Joined: 20. Sep 2022, 19:28

Re: Configuring Virtual Network & Local Network To Have Accesss To Each Others Clients

Post by Turbo1982 »

@BillG Thanks the networking side of things is what I am unsure of at this point I am not sure how to configure the networking within Virtual Box and on the physical and virtual routers. I have done some research and can't seem to find any information on setting up your internal network physical LAN to communicate with your virtual LAN, My goal is to have all clients on both networks able to communicate with each other.

I am hoping that someone can confirm that what I want to do is possible and that it is not a limitation within virtual box that will prevent me from achieving my goal?. It would be a bonus if someone could point me to some documentation or videos that could help me

The only documentation I have found that is close is how to get two virtual networks to communicate with each other within virtual box

Any help would be greatly appreciated
BillG
Volunteer
Posts: 5102
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Configuring Virtual Network & Local Network To Have Accesss To Each Others Clients

Post by BillG »

You run your vms on an internal virtual network and the default gateway is set to the IP of the interface which is the private side of your virtual router. The public side of your internal router is bridged to a physical NIC in your host PC. How you configure the virtual router depends on whether you want it to do NAT for the private network or not.

The only case where it will not work is if you cannot configure a static route on your physical router to bounce the private network traffic back to the virtual router. (By default this traffic would go out to the Internet and routing would fail between networks). Simple IP routing between two networks only works if the default gateway of each network is the router interface. If this is not the case, you need static routes.
Bill
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Configuring Virtual Network & Local Network To Have Accesss To Each Others Clients

Post by scottgus1 »

I'll just add that it is possible to have your VMs connect out of the host on the secondary Ethernet port on your host PC to the LAN router.

Please see Virtualbox Networks: In Pictures, especially the section on Bridged.

You can control which Ethernet port the VM's network attaches to by setting the VM network adapter "Attached To:" dropdown to Bridged, and the "Name:" dropdown to the secondary Ethernet port. Now, any VM Bridged to that port will have all its traffic go through that port (as long as you don't put other networks in the VM).

To keep the host from trying to connect through that Ethernet port as well, go to the Ethernet port's Properties and turn off everything in the Bindings checkbox list except for the Virtualbox Bridged binding:
Image

Please see "Sandbox" in the Pictures tutorial for a setup where one or more VMs are connected through Internal to a pfSense router VM, which then Bridges to the outside world. (Since you'd be Bridging the VMs to the secondary Ethernet port and blocking the host from that secondary Ethernet port, you'd probably not need the "Sandbox" firewall rule to block the host LAN.)

Then, connect the secondary Ethernet port to the physical LAN router, and do all of what's necessary to get the pfSense traffic integrated into the host LAN. The host and other LAN PCs would communicate to the VMs through the Bridged secondary Ethernet adapter.

At this point, you'd have two separate LANs handled by routers, and the second router's WAN port is plugged into one of the first router's LAN ports. Find a tutorial online with this kind of configuration between the LANs and apply the settings to your physical LAN router and the pfSense router. Virtualbox Bridged has no port-forwarding or such, so there would be no settings to apply in Virtualbox settings.

How to integrate the pfSense router to the LAN router so traffic can pass is way over my head, though.
Turbo1982
Posts: 3
Joined: 20. Sep 2022, 19:28

Re: Configuring Virtual Network & Local Network To Have Accesss To Each Others Clients

Post by Turbo1982 »

@scottgus1 Thanks I am new to the group. where can I find the tutorial you are referencing

Thanks
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Configuring Virtual Network & Local Network To Have Accesss To Each Others Clients

Post by mpack »

Click on the link Scott provided.
Post Reply