How to setup a DHCP server / client configuration in VirtualBox

Discussions about using Windows guests in VirtualBox.
Post Reply
chenchih
Posts: 2
Joined: 28. Nov 2021, 08:07

How to setup a DHCP server / client configuration in VirtualBox

Post by chenchih »

HI, i am having some trouble on setting up a dhcp in virtual box.

I'm trying to implement DHCP on two VirtualBox machines, which both are running Window 10 (One as client, one as server) and the host is a Windows 10.
So this is the step:
My Host is window 10 Ip is 192.168.56.x

Window 10 as server (dhcp server)
1. I set static IP 192.168.100.20
2. download and install dhcp server using tool: tftp64
3. firewall disable

Window 10 as client
1. set IP to DHCP
2. it will not get the Dhcp according to what I set

under virtual box my network-setting:

I try with bridge, host-only-adapted and none will work

I set server and client VirtualBox network as: host-only-adapted, client will get 192.168.56.X domain
I set server and client VirtualBox network as: bridge, the client will get 192.168.50.X domain, which is the same as host
if i set internal network, will not get ip address

Does anyone know how to set it correctly.

HOST --------- VM1(dhcpserver)
|
|------VM2(client)

I just want to set dhcpserver in VM1 and VM2 can get the ip from dhcpserver
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How to setup a DHCP server / client configuration in VirtualBox

Post by mpack »

A vitally important factor is to make sure that no other DHCP server is operating on the same network, a factor which you do not address in your above post.

You said you "tried with bridge" - but bridging to what physical network and why? If that network already has DHCP then all you'll do is break the physical network too. Likewise "Host-only" network includes a DHCP provided by VirtualBox which is enabled by default, and you do not mention disabling it.

If nothing but the two VMs is to be involved in the network then you should find a plain "Internal Network" to be far simpler. Just make sure that both VMs are configured as belonging to the same internal network (i.e. the same name).
chenchih
Posts: 2
Joined: 28. Nov 2021, 08:07

Re: How to setup a DHCP server / client configuration in VirtualBox

Post by chenchih »

I upload my topology
Attachments
TOPOLOGY.PNG
TOPOLOGY.PNG (13.84 KiB) Viewed 9150 times
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How to setup a DHCP server / client configuration in VirtualBox

Post by mpack »

Thanks, but a wiring diagram does not answer my questions.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: How to setup a DHCP server / client configuration in VirtualBox

Post by scottgus1 »

chenchih, you really need to understand what the Virtualbox networks do. See Virtualbox Networks: In Pictures.

Mpack pointed out that setting a VM with a DHCP server onto a network with a running DHCP server will break the network. Setting your DHCP server VM to Bridged will put it on the host's physical network and disrupt the physical network. So Bridged is not going to work.

Host-Only could work for your test. But Host-Only also has a running DHCP server by default, which will cause the same disruption as Bridged. Host-Only's DHCP server can be turned off, though, which would allow your DHCP server VM to be the Host-Only network's DHCP server for your test. Using Host-Only could allow your host to participate in the test, but further Host-Only settings have to be changed to match your DHCP server VM's IP range.

As Mpack said, Internal is the easiest way to set up your test. Internal has no built-in DHCP server by default. Connect both VMs to the same Internal network, then let the server VM provide DHCP for the client VM.
Post Reply