This is the command I use in host OS, unfortunately guest OS still can't get the DHCP ip.
Both OS are running in Linux.
wolf@linux:~$ vboxmanage dhcpserver add --network=malfoy --server-ip=10.38.1.1 --lower-ip=10.38.1.110 --upper-ip=10.38.1.120 --netmask=255.255.255.0 --enable
wolf@linux:~$
Verification
wolf@linux:~$ vboxmanage list dhcpservers
NetworkName: malfoy
Dhcpd IP: 10.38.1.1
LowerIPAddress: 10.38.1.110
UpperIPAddress: 10.38.1.120
NetworkMask: 255.255.255.0
Enabled: Yes
Global Configuration:
minLeaseTime: default
defaultLeaseTime: default
maxLeaseTime: default
Forced options: None
Suppressed opts.: None
1/legacy: 255.255.255.0
Groups: None
Individual Configs: None
wolf@linux:~$
Guest OS
guestOS$ ip a s enp0s3
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:aa:aa:aa brd ff:ff:ff:ff:ff:ff
guestOS$
guestOS$ sudo dhclient enp0s3 -v
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/enp0s3/08:00:27:aa:aa:aa
Sending on LPF/enp0s3/08:00:27:aa:aa:aa
Sending on Socket/fallback
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 3 (xid=0xc1337)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 7 (xid=0xc1337)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 10 (xid=0xc1337)
...
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 8 (xid=0xc1337)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 11 (xid=0xc1337)
DHCPDISCOVER on enp0s3 to 255.255.255.255 port 67 interval 14 (xid=0xc1337)
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
guestOS$
Reference:
https://progmar.net.pl/en/knowledge-base/virtualbox-adding-dhcp-server
https://www.youtube.com/watch?v=mvsiuLzpx2E
How do I troubleshoot this issue?
You might find the following question weird, but I've seen it solved most of the issues in VirtualBox.