VirtualBox Guest OS failed to resolve hostname of external websites

Stanley Meng
1 min readJun 21, 2023

NOTE, I just used forinstance.com as an example.

Problem: when you run ‘wget http://forinstance.com’ in your Guest OS, you got error: Name or service not known

But your Host OS is fine to resolve the forinstance.com.

The solution works for my setup:

  1. Double check it’s indeed a DNS resolution issue. SSH into your Guest OS, mine is Ubuntu. Add “<IP of the forinstance.com> forinstance.com” to /etc/hosts. Try ‘wget http://forinstance.com’, if it works, most likely you have DNS issue with your Guest OS. Continue Step 2
  2. In your Host OS, mine is OS X 14, run this command: VBoxManage list runningvms . If you use Windows, it’s under c:\Program Files\Oracle\VirtualBox\VBoxManage.exe
  3. Get your VM’s name from Step 3, say, its output is:
    $ VBoxManage list runningvms
    “ub22” {d955c91d-8333–46e9-af3c-e66214c60493}
  4. Shutdown your Guest OS
  5. Get the name ub22 as param, then run the command:
    VBoxManage modifyvm “ub22” --natdnshostresolver1 on

--

--