0

Is there a way to block specific hostnames from being accessible in Virtualbox guests?

For example, I want to block all access to superuser.com or stackoverflow.com in the OS running in a Virtualbox VM, or maybe point those hostnames to 127.0.0.1 or a dummy address. What's the best way to accomplish this?

  • Please register your account fully. Use this link if it's necessary. After you regain control over your question, accept the answer instead of posting "thank you". Take our tour to see how the site works. – Kamil Maciorowski May 3 '18 at 14:50
1

Is there a way to block specific hostnames from being accessible in Virtualbox guests?

All the normal methods of blocking websites for physical machines are possible with VirtualBox guests as well. You can:

  • Modify the guest's hosts file and direct the given requests to the IP(s) of your choice there.

  • Set up a local DNS server and route the guest's DNS requests to that server (which, again, would resolve those certain requests to any IP(s) of your choice.)

  • Set up a proxy server to block requests to those addresses from the guest.

Regarding the DNS and proxy server solutions, either of these servers could be on the guest itself, another virtual machine, the host or another physical machine on the network.


It is probably worth mentioning that you don't need to give guests Internet access in the first place — you can use Host-Only network adapters, for instance.


What's the best way to accomplish this?

For minimal security, solutions that rely on the guest machine are probably less secure than those that rely on a separate virtual machine, the host or another physical machine.

Other than that, the best solution probably depends greatly on your network and why/how you wish to block those addresses.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.