Connecting different subnets

Discussions related to using VirtualBox on Windows hosts.
Post Reply
daybreaker
Posts: 1
Joined: 17. Apr 2020, 21:26

Connecting different subnets

Post by daybreaker »

Hi everyone,

I'm teaching myself working with Domain Controllers and to test it I wanted to set up a small "business environment" in VirtualBox.

I created different subnets for each department. Now I want every host to be able to connect to the DC (for Active Directory, DHCP, etc). I would think that in the real world, switches would take care of this, but I can't really find an option to do this.

I created the subnets on the 192.168.0.0 /23 network, and every subnet has the /27 prefix. But I can't get them to connect to eachother.

For example:

Domain controller IP: 192.168.0.1
Random host IP: 192.168.1.40

If I just enter this they won't be able to connect cause afaik I need switched to be able to connect between different subnets. But is there a way to do this in virtualbox?

I used an online calculator to calculate the subnets:


Subnet Name Needed Size Allocated Size Address Mask Dec Mask Assignable Range Broadcast
A 16 30 192.168.0.0 /27 255.255.255.224 192.168.0.1 - 192.168.0.30 192.168.0.31
B 16 30 192.168.0.32 /27 255.255.255.224 192.168.0.33 - 192.168.0.62 192.168.0.63
C 16 30 192.168.0.64 /27 255.255.255.224 192.168.0.65 - 192.168.0.94 192.168.0.95
D 16 30 192.168.0.96 /27 255.255.255.224 192.168.0.97 - 192.168.0.126 192.168.0.127
E 16 30 192.168.0.128 /27 255.255.255.224 192.168.0.129 - 192.168.0.158 192.168.0.159
F 16 30 192.168.0.160 /27 255.255.255.224 192.168.0.161 - 192.168.0.190 192.168.0.191
G 16 30 192.168.0.192 /27 255.255.255.224 192.168.0.193 - 192.168.0.222 192.168.0.223
H 16 30 192.168.0.224 /27 255.255.255.224 192.168.0.225 - 192.168.0.254 192.168.0.255
I 16 30 192.168.1.0 /27 255.255.255.224 192.168.1.1 - 192.168.1.30 192.168.1.31
J 16 30 192.168.1.32 /27 255.255.255.224 192.168.1.33 - 192.168.1.62 192.168.1.63
K 16 30 192.168.1.64 /27 255.255.255.224 192.168.1.65 - 192.168.1.94 192.168.1.95

Does anyone have an idea on how to achieve my idea?

Thanks in advance.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Connecting different subnets

Post by scottgus1 »

Take a look at Virtualbox Networks: In Pictures. See what you can put together.
BillG
Volunteer
Posts: 5104
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: Connecting different subnets

Post by BillG »

No, that is not correct. To move data from one subnet to another you need a router. The router needs one interface in each subnet so that it can transfer traffic between subnets. Do not try to use your DC as a router - that leads to bad outcomes.

The simplest routing setup is two segments connected by a router. Each segment has its own IP subnet. The router is the default gateway for both segments.

192.168.2.x /24 dg 192.168.2.254
|
192.168.2.254 dg blank
router
192.168.5.254 dg blank
|
192.168.5.x /24 dg 192.168.5.254

Transfers within a subnet are done directly. Traffic which cannot be delivered directly (ie not in the same subnet) goes to the default gateway of the segment (which is the router). The router forwards it to its interface in the other segment, where it is delivered directly to the target address.

If you have more than two subnets, or if you want the machines to have external access (eg to the Internet) it gets harder, especially in a Windows domain setup.

Note. This really has nothing to do with VirtualBox. IP works exactly the same way with physical machines and networks. The same applies to the previous post in this forum about DHCP reservations. It seems to be the day for IP questions!
Bill
Post Reply