Access internal network through Bridge adapter

Discussions related to using VirtualBox on Windows hosts.
Post Reply
davide1611
Posts: 2
Joined: 27. Apr 2020, 11:16

Access internal network through Bridge adapter

Post by davide1611 »

I'm using virtualbox 6.0.14 on Windows 10 (45.78.15.115). I created a VM with ubuntu 18:04 and in VBox panel I choose two network adapter:
- bridged adapter - 45.78.15.116
- internal network - 192.168.1.1

I'm able to ping from Win10 to bridged adapter interface but cannot ping to internal network interface
My goal is to ping from Windows10 host to the internal network, is it possible?
I enabled net.ipv4.ip_forward=1 in ubuntu but doesn't work. Should I set something on VBox?
Maybe I have to enable some iptables rules and it's an ubuntu question, if so I apologize in advance but I think someone in the community has already encountered this difficulty.
Thank you so much.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Access internal network through Bridge adapter

Post by mpack »

Nope. Those are two separate networks.

It's like one PC having two network cards connected to different LANs on each card. Unless you installed routing software on the PC then the two networks remain separate. This is nothing special - it's exactly how any PC behaves in that scenario.

You should ask why you would want to create two networks like that. The purpose of "Internal network" is to let two VMs talk to each other without requiring a physical network or allowing Internet access. I can't think of any reason for trying to bridge that virtual network to a physical one, and you don't even mention having more than one VM.
davide1611
Posts: 2
Joined: 27. Apr 2020, 11:16

Re: Access internal network through Bridge adapter

Post by davide1611 »

Thanks for your answer. In my internal network there are few VMs: DHCP server, DNS and FOG server. At the beginning, I create it to avoid conflict between different DHCP server (my router and that created by me). Now, I realized I had to access it from the outside and I'm thinking a way to do it. So, looking at your answer, inserting a iptables rule I should solve the problem?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Access internal network through Bridge adapter

Post by mpack »

davide1611 wrote:So, looking at your answer, inserting a iptables rule I should solve the problem?
I don't see how that would make your PC act as a router between the two networks. However I don't consider myself to be a networking expert, so if the obvious solution of bridging all VMs to the physical network (and switching off any conflicting DHCP servers) is not appropriate, then I'll have to leave you to consider the general networking issues yourself.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Access internal network through Bridge adapter

Post by scottgus1 »

See Virtualbox Networks: In Pictures. Bridged and Internal are explained, as well as two other possibilities, NAT network and Sandbox.

NAT network with DHCP turned off allows your guests with a DHCP server and other web servers to exist in a little private LAN, and you can port-forward to allow the host and other physical LAN computers to access the web servers. NAT network does allow the guests to see and access the host LAN as well as the internet.

Sandbox also allows blocking the host LAN while allowing the host's internet through into the private network.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Access internal network through Bridge adapter

Post by BillG »

As stated earlier, you cannot communicate between devices in different IP subnets without an IP router. It is possible to access machines on an internal network from another network (just as it is possible to access a group of physical machines running on a physical switch, which is the same thing from a networking point of view). The method is the same in both cases - you need an IP router and probably some static routes.

If you are running your own DHCP server in the internal network, itables probably will not work for you. itables allows you to access the NAT tables, because it assumes that the private network is using NAT itself to allocate IP addresses to the private LAN, not an internal DHCP server.
Bill
Post Reply