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.
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.
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?