我可以通过创建一个适配器,VBoxManage hostonlyif create
但是如何使用 DHCP 来配置它,它似乎没有VBoxManage hostonlyif ipconfig
为 DHCP 提供任何参数:
Kits-MacBook-Air:media-pop kitsunde$ VBoxManage hostonlyif ipconfig vboxnet0
Oracle VM VirtualBox Command Line Management Interface Version 4.1.16
(C) 2005-2012 Oracle Corporation
All rights reserved.
Usage:
VBoxManage hostonlyif ipconfig <name>
[--dhcp |
--ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |
--ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]
create |
remove <name>
Syntax error: Not enough parameters
Kits-MacBook-Air:media-pop kitsunde$ VBoxManage hostonlyif ipconfig vboxnet0 --dhcp
VBoxManage: error: Code NS_ERROR_NOT_IMPLEMENTED (0x80004001) - Not implemented (extended info not available)
Context: "EnableDynamicIpConfig ()" at line 244 of file VBoxManageHostonly.cpp
答案1
好像我可以这样做:
VBoxManage hostonlyif create
VBoxManage hostonlyif ipconfig vboxnet0 --ip 192.168.56.1
VBoxManage dhcpserver add --ifname vboxnet0 --ip 192.168.56.1 --netmask 255.255.255.0 --lowerip 192.168.56.100 --upperip 192.168.56.200
VBoxManage dhcpserver modify --ifname vboxnet0 --enable