DNS problems with QEMU and Android Emulator


(I don’t know if this belongs under “Newbie” because I feel like a n00b here…)

I’m having a weird problem within QEMU on my laptop, and I’d like help debugging and fixing it:

  • When I’m on the wifi network at work with my laptop, I can NOT do DNS lookups within QEMU.
  • When I’m on my home wifi network OR use my phone as a hotspot, DNS looks DO work within QEMU.
  • For completeness: DNS works from on my laptop (firefox, ping, …) in any of above setups.

I would like to be able to reach the network from QEMU from my work network too.

I’m experiencing the exact same behavior within the Android Emulator, which I believe is a fork of QEMU.

I first looked into the firewall and ensure the two connections used the same profile, but since that didn’t change anything I ended up disabling the firewall entirely. This did not affect the problem.

Some info:

$ sudo systemctl stop firewalld

$ sudo iptables --list
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy DROP)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

$ sudo iptables -S

I’m starting to think that this has something to do with my work’s network, but I can’t see how that’s possible; I mean, QEMU should be bridging transparently though my host, right?

What to do?



QEMU or any other virtual machine software uses NAT (Network Address Translation). Which translates your normal IP to another virtual IP that is in a different IP range than your host computer.

You can manually change the connection type to bridge the network connection. Which should emulate your physical network card behavior.

I don’t know how your office/workplace firewall is set up (normally offices do have a hardware firewall nowadays). Firewalls are configured to stop alien IP ranges from accessing outside of the LAN or wise versa.

This is done to prevent users from using virtual environments to do bad things using offices or any other important connections. But when it comes to your home connection and or your phone hotspot. They don’t have the level of security of your office. Consumer devices are configured to be more simple and hassle-free. This might be why you’re not allowed to access the internet using your VM when at the office.

I also have advice. Check your office’s cyber or data security policy before trying to use VMs. Because using VMs is frowned upon. Because most people use VMs to mask what bad things their doing or to get around a security policy. Most companies will fire people on-site as soon as they find them using VMs without prior authorization.

If you really need to use your VM then get the proper authorization and get your administrator to set up the firewall so it allows your virtual IP addresses.

So, be careful. And I hope this helped.

Thanks for taking the time to reply.

I don’t really know what to do with it, except perhaps follow your advise on contacting IT – and ask what’s going on.

Have a nice day.

Could you provide some insight into the networks in question in the format IP.x.y.0/24

Which frontend did you use to configure/setup the vm in question?

Perhaps there is a network collision between the network of your qemu vm and your work e.g.

E.g. your workplace’s network is which which is default for qemu - thus your qemu cannot connect.