How can I have a private network with a DHCP server and clients into VirtualBox

Discussions related to using VirtualBox on Linux hosts.
Post Reply
pierrot1010
Posts: 5
Joined: 30. May 2022, 11:24

How can I have a private network with a DHCP server and clients into VirtualBox

Post by pierrot1010 »

Hello,

I installed VirtualBox on a Linux Ubuntu 20.04.
I created my first machine where I installed Windows Server 2019 and I am planning to install the DHCP role.
Then I am going to create 2 or 3 virtual mchine with Windows 10.

The goal is to be trained with the configuration of the DHCP server with some DHCP clients.

My Linux Host is on y company network and I would like to know how I can configure VirtualBox, to make sure the my Widnows server and clien to not communicate with my company network, The goal is to have my private network into VirualBox, but it would be nice to be able to access internet from my windows machine with Firefox

Is possible to configure VirtualBox as a firewall and to block the UDP 67 port?

I would like to avoid to be warmed by the the admin IT because of my DHCP server

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

Re: How can I have a private network with a DHCP server and clients into VirtualBox

Post by mpack »

Have a look at the network options supported by VirtualBox. Some of them have a DHCP server, for others (i.e. "Internal networking") you'd have to supply your own. The latter sounds like what you want.

Virtualbox Networks: In Pictures.
pierrot1010
Posts: 5
Joined: 30. May 2022, 11:24

Re: How can I have a private network with a DHCP server and clients into VirtualBox

Post by pierrot1010 »

Hello
Thanks for your reply.

In my VirtualBox, now I created two machine. On with Windows Sever and the second with Windows 10.
On both machines, I right click on the network icon (bottom right), I selected Network Settings and o the Network tab, I choosed Internal network.
Image
On the server, I setted an IP: 192.168.2.10 and i created a scope from 192.168.2.11 to 192.18.2.50
I sarted the machine with Windows 10 and from cmd I entered ipconfig. The IP is 194.254.225.85, but i should be 192.168.2.11
From the Windows 10, I ping 192.168.2.10 but nothing happen.
Moreover, on my both machine, at the bottom right, I have a earth instead of the network icon, like if a the network cable of a workstation is disconnected.
It's look like both machine are not connected to a virtual network

What should I do more for my DHCP workshop to make sure that both machines (and more) can communicate?

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

Re: How can I have a private network with a DHCP server and clients into VirtualBox

Post by scottgus1 »

A suggestion: you need to proofread your posts. There are several typos which, if taken as typed, show some problems in your IP address configurations. These are probably fat-fingers, but accuracy in networking and in troubleshooting are important.

Additionally, you'll notice that [IMG] tags don't work for 3rd-party-link sites. [IMG] only works for images previously uploaded using the forum's Upload Attachment tab. You can find your previous attachments under your forum User Control Panel link, Manage Attachments.

We need some things to troubleshoot this:

1. For each VM, please right-click the VM in the main Virtualbox window's VM list, choose Show in Explorer/Finder/File Manager. Copy the VM's .vbox file (not the .vbox-prev file) to the desktop. (Configure your host OS to show all extensions if the folder that opens does not show a .vbox file.) Zip up all of the .vbox files, and post the zip file, using the forum's Upload Attachment tab.

2. Also, for each VM and for the host, open a Command Prompt/Terminal and run ipconfig /all for Windows or ip address for Linux. Post the command output. Label which is which.

3. Finally, start all the VMs from full normal shutdown, not save-state. Run until you see the network problem happen, then shut down the VM from within the VM's OS. Right-click each VM in the main Virtualbox window's VM list, choose Show Log. Save the far left tab's log to the desktop, naming each log so we know which VM it came from. Zip all the logs, and post the zip file, using the forum's Upload Attachment tab.
pierrot1010
Posts: 5
Joined: 30. May 2022, 11:24

Re: How can I have a private network with a DHCP server and clients into VirtualBox

Post by pierrot1010 »

Hello,
I can not send a VM. I am not allowed to do that, sadely.

I wonder, If I missed a step. I watched that video https://www.youtube.com/watch?v=hJtOw1ofetM . From the minute 4:10 and 4:59, it said, I should create a virtual network by renaming the name of the 'Internal Network' of Virtual Box.
Later, it said to cd the folder where is the VMs. Then to enter the commande

Code: Select all

vboxmanage dhcpserver add --netname [name]
Sadly, the tuto is done on a Windows Host machine and I have an Ubuntu workstation with the VirtualBox and two Windows VM.

I wonder, if I have to open a terminal and simply enter the commands, to connect the two VM in their own netwok

Code: Select all

cd #to be at root of the home folder
vboxmanage dhcpserver add --netname [name]
Thnaks
It looks necessary to make a network with my two VMs, because, on my two VMs, after starting it and Windows has booted, at the bottom-right of the Windows, the network icon is not showed which clairely means not network connection (I have the earth instead)
pierrot1010
Posts: 5
Joined: 30. May 2022, 11:24

Re: How can I have a private network with a DHCP server and clients into VirtualBox

Post by pierrot1010 »

I think, that was not a good idea

Code: Select all

vboxmanage dhcpserver add
but

Code: Select all

vboxmanage netnetwok add
Isn't?
pierrot1010
Posts: 5
Joined: 30. May 2022, 11:24

Re: How can I have a private network with a DHCP server and clients into VirtualBox

Post by pierrot1010 »

This is really much better

Code: Select all

VBoxManage natnetwork add --netname DHCPlab2--network "192.168.11.0/24" --dhcp on --enable
Both VMs can communicate, but they receive an IP address. I do not want them to receive an IP address, as I am configuring a DHCP on one of them

I ran

Code: Select all

VBoxManage natnetwork modify --netname DHCPlab2 --dhcp off
For the first VM which has the DHCP server, I configured an static IP address
192.168.11.1
255.255.255.0
192,168,11,1 (Gatewaqy)
192.168.11.1 (DNS)
On the second VM, I have not changed he network configuration, as it has to be dynamic. That VM (windows10) should reveive an IP from the first VM (DHCP server)

The problem now, both are not connectd to DHCLlab2. At the bottom righ, I see the earth icon instead of the screen, as if a netwrk cable was not connected.

What's wrong?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: How can I have a private network with a DHCP server and clients into VirtualBox

Post by scottgus1 »

pierrot1010 wrote:I can not send a VM. I am not allowed to do that, sadely.
If this means the forum won't let you post something, please be aware I didn't ask for the whole VM, only the ".vbox" text files, zipped, which define the VMs and which easily fits the forum's Upload Attachment as a zipped file. Logs will also fit when zipped, as will a PNG screenshot from the VM. Text from command outputs can be copy/pasted as text.

If this means you cannot get permission from the bosses to send diagnostic data, then we cannot help. You'll have to get your bosses to fix the setup, since we aren't being allowed to.
Post Reply