0

Desired Outcome

I want to block a.com on a host machine, but allow it on a guest VM. (I would also like to use dnsmasq to re-point domains on the guest machine independently.)

Details

On a Linux Mint host machine I have dnsmasq running. The dnsmasq.conf file blocks domain a.com with address=/a.com/127.0.0.1 as desired.

I have QEMU/KVM installed on this host and created a guest VM also running Linux Mint with dnsmasq. Pinging a.com on the VM results in pointing to 127.0.0.1, effectively blocking a.com on the VM which is not what I want.

I'm assuming this has something to do with the network configuration on the VM, but I'm not sure.

Finally

My primary desire is to prevent the Host from accessing a.com while allowing a Guest to access a.com, but prevent the Guest from accessing b.com. I like dnsmasq because it gives me the ability to specify a domain and all it's sub-domains, wheras the hosts file requires addressing sub-domains specifically. If there a better/simpler way to do this, I'm open.

1
  • @roaima I believe your comment is worth being upgraded to an Answer, I suggest you do it - perhaps with a correct resolver config line.
    – Ned64
    Mar 28, 2021 at 21:38

1 Answer 1

1

This doesn't really block anything - all you've done there is tell your host's DNS lookup to return a different address for the name. There's nothing stopping client applications ignoring your local DNS and using another, so it's more like smoke and mirrors than an actual block.

Your VM is using your host's DNS, so it's also affected. One possibility is that maybe it was given to your VM via DHCP, but since there's nothing intrinsic about using the host's DNS server just choose another one on the VM. How you would do that depends on the way your VM gets its IP address. I run most of my Debian servers with old-school static configurations so I'm probably not the best person to suggest a way to do this

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .