The DNS server of my host cannot be reached by the guest. Instead I want VirtualBox to tell the guest over DHCP that it should use the DNS server 8.8.8.8.
How do I do that?
With the default network type "NAT" it does not seem to be possible to setup the DHCP server in any way.
I managed to setup a DHCP server using the network type "NAT-Network" using commands like:
VBoxManage natnetwork add --netname MYNET --network "10.20.14.0/24" --enable VBoxManage dhcpserver add --netname MYNET --ip 10.20.14.3 --netmask 255.255.255.0 --lowerip 10.20.14.200 --upperip 10.20.14.250 --enable VBoxManage dhcpserver modify --netname MYNET --set-opt 6 8.8.8.8 VBoxManage modifyvm MYVM --nic1 natnetwork --nat-network1 MYNETAfter this "VBoxManage list dhcpservers" gives something like:
NetworkName: MYNET Dhcpd IP: 10.20.14.3 LowerIPAddress: 10.20.14.200 UpperIPAddress: 10.20.14.250 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 6/legacy: 8.8.8.8 Groups: None Individual Configs: NoneBut when I start the VM VirtualBox seems to override the DNS server to what the host has configured! And after this, "VBoxManage list dhcpservers" gives something like:
NetworkName: MYNET Dhcpd IP: 10.20.14.3 LowerIPAddress: 10.20.14.200 UpperIPAddress: 10.20.14.250 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 3/legacy: 10.20.14.1 6/legacy: 127.0.0.2 15/legacy: my.domain.com Groups: None Individual Configs: NoneWhere 127.0.0.2 is the DNS server configured on the host.
I use both Windows guest and Windows host.