Virtualization
VirtualBox: very slow DNS in a NAT guest
On some networks, DNS lookups inside a VirtualBox guest were slow enough to make package managers like npm or gem painful, especially while building Docker images.
VBoxManage modifyvm <vm-name> --natdnsproxy1 on
VBoxManage modifyvm <vm-name> --natdnshostresolver1 on
By default the NAT engine’s DHCP server hands the host’s DNS servers straight to the guest, so the guest keeps using them after the host has moved to another network. Both settings stop that, in different ways: proxy mode intercepts the queries and forwards them to whichever servers the host currently uses, while host resolver mode decodes the queries and answers them through the host’s resolver API.
The 1 is the NAT adapter number. The VirtualBox 7 VBoxManage modifyvm reference spells these
options --nat-dns-proxy1 and --nat-dns-host-resolver1; the old spellings above are still
accepted as aliases.
This is a boot2docker-era note. Docker on macOS and Windows no longer runs through VirtualBox, so it only applies if you still drive VirtualBox guests directly.