- 在VirtualBox创建HostOnly Networks时选择Enable DHCP Server
例如:
Adapter IPv4地址: 192.168.56.1
DHCP Server地址: 192.168.56.2
Server Mask: 255.255.255.0
Lower Address Bound: 192.168.56.3
Upper Address Bound: 192.156.56.254
- 在VM里面修改
$ sudo vim /etc/sysconfig/network-scripts/ifcfg-<interface_name>
BOOTPROTO="dhcp"
ONBOOT="yes"
- 重启Network Manager
$ sudo systemctl restart NetworkManager
- 使用ipconfig命令验证