You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu主机配置ISC-DHCP-Server为VirtualBox虚拟机固定分配DHCP IP地址失败求助

Ubuntu主机配置ISC-DHCP-Server为VirtualBox虚拟机固定分配DHCP IP地址失败求助

Hey there, let's troubleshoot why your fixed IP assignment for the vmr120 VM isn't working as expected. I've run into similar issues before, so here are the key checks and fixes to try:

  • Verify VirtualBox Network Mode First
    This is the most common pitfall! If your VM is using NAT mode, it's actually using VirtualBox's built-in DHCP server—not your host's ISC-DHCP-Server. Head to VirtualBox → Select vmr120 → Settings → Network, and switch the adapter to Bridge Adapter (connected to your host's physical network interface). This ensures the VM sends DHCP requests to your host's server.

  • Double-Check the MAC Address
    Make sure the hardware ethernet value in your dhcpd.conf matches the VM's actual MAC exactly. You can find the VM's MAC in VirtualBox's network settings (under "Advanced" for the adapter). Even a single wrong character will break the fixed IP mapping.

  • Ensure Fixed IP is Valid & Available

    • Confirm 192.168.1.22 isn't within the auto-assigned range in your dhcpd.conf (check the range line in your subnet configuration). If it is, the server might prioritize dynamic assignment over the fixed entry.
    • Run ping 192.168.1.22 from your host to check if the IP is already occupied by another device. DHCP won't assign an IP that's in use.
  • Validate DHCP Server Interface Listening
    Open /etc/default/isc-dhcp-server and check the INTERFACESv4 (or INTERFACES) line—it should be set to the network interface your VM is bridged to (e.g., INTERFACESv4="enp0s3"). If the server isn't listening on the correct interface, it won't receive the VM's DHCP requests.

  • Clear Old DHCP Leases

    • On the VM, run these commands to release and renew the lease:
      sudo dhclient -r
      sudo dhclient
      
    • On your host, check the DHCP lease file at /var/lib/dhcp/dhcpd.leases. If there's an old lease entry for vmr120, delete it, then restart the server again with sudo systemctl restart isc-dhcp-server.service.
  • Check DHCP Server Logs for Clues
    Run this command to view the server's logs—it will show if the VM's DHCP request is being received, and if there are any errors (like MAC mismatches or IP conflicts):

    sudo journalctl -u isc-dhcp-server.service
    

Try these steps one by one, and you should be able to get the fixed IP working for your VM.

备注:内容来源于stack exchange,提问作者jeets

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 11:43:00