4

I have tried to use dnsmasq as the name server for virtual machines. On all the vm-s, /etc/resolv.conf indicates the vm need to access 192.168.15.3 to resolve the domain names. However, the interface holding 192.168.15.3 is lying inside a network namespace on the host.

I can ping 192.168.15.3 from both virtual machine and host(inside the network namespace). And lsof -i:53 outside the network namespace shows dnsmasq is listening on port 53. If I run lsof -i:53 inside the network namespace, there is nothing.

If I change the content in /etc/resolv.conf to use any interface's ip address in host's public namespace, the name resolution works well. It seems that dnsmasq process didn't go wrong.

I've tried ip netns exec <THE NAMESPACE> systemctl start dnsmasq after stops dnsmasq, but only see dnsmasq opens its port inside the public namespace.

What should I do if I don't want to modify resolv.conf inside the vm but only configure something on the host? How to make port 53 accessible inside the network namespace?

0

http://man7.org/linux/man-pages/man8/ip-netns.8.html

A network namespace is logically another copy of the network stack, with its own routes, firewall rules, and network devices.

So you need something like this: Iptables to redirect DNS lookup IP and Port

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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