I’ve figured out a way to start snap apps from a network namespace enabled shell. The netns shell replaces (bind mount?)
/etc/resolv.conf with the content specific to that namespace (from
/etc/netns/XX/resolv.conf), which allows applications inside the netns to use a different DNS server from the host.
However, when launching snap apps from the netns, the snap environment does not inherit the
/etc/resolv.conf from the netns, it instead uses resolv.conf from the host. At the same time, the network interfaces and routing table are inherited from the netns.
Is there any way to set a specific DNS server to be used only for a snap?