这是我在主机操作系统中使用的命令,不幸的是客户操作系统仍然无法获取 DHCP ip。
两个操作系统均在 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:~$
确认
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:~$
客户操作系统
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$
参考:
https://progmar.net.pl/en/knowledge-base/virtualbox-adding-dhcp-server
https://www.youtube.com/watch?v=mvsiuLzpx2E
我该如何解决此问题?
答案1
您可能会发现以下问题很奇怪,但我发现它解决了 VirtualBox 中的大多数问题。
- 您是否安装了 VirtualBox Guest Additions?
- 您是否重新启动了客户操作系统
- 您是否重新启动了主机操作系统