Use virtualbox as the provider and run the following Vagrantfile.
This works without any issues.
Vagrant.configure("2") do |config|
config.vm.boot_timeout = 300
config.vm.box = "ubuntu/jammy64"
config.vm.network "private_network",
type: "dhcp",
name: "VirtualBox Host-Only Ethernet Adapter"
config.vm.provider "virtualbox" do |vb|
vb.name = "parimary"
vb.memory = 1024
vb.cpus = 2
end
end
The following has been created as a DHCP server.
# VBoxManage.exe list dhcpservers
NetworkName: HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter
Dhcpd IP: 192.168.56.2
LowerIPAddress: 192.168.56.3
UpperIPAddress: 192.168.56.254
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
I want to change the settings of this DHCP server to the following:
- Dhcpd IP: 192.168.56.100
- LowerIPAddress: 192.168.56.101
- UpperIPAddress: 192.168.56.254
Change the configuration in VBoxManage as follows:
VBoxManage dhcpserver modify --netname "HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter" --ip 192.168.56.100 --netmask 255.255.255.0 --lowerip 192.168.56.101 --upperip 192.168.56.254 --enable
I run the Vagrantfile again I get the following error:
A host only network interface you're attempting to configure via DHCP
already has a conflicting host only adapter with DHCP enabled. The
DHCP on this adapter is incompatible with the DHCP settings. Two
host only network interfaces are not allowed to overlap, and each
host only network interface can have only one DHCP server. Please
reconfigure your host only network or remove the virtual machine
using the other host only network.
After some trial and error, it appears that Vagrant only works in the following cases:
Dhcpd IP: 192.168.56.2
LowerIPAddress: 192.168.56.3
UpperIPAddress: 192.168.56.254
Would it be possible to change the configuration of the DHCP server?
I would like to have a network where DHCP and static IPs can coexist.