Answer the question
In order to leave comments, you need to log in
How to disable file rebind or make an overlay for a certain process?
The previous question was about creating a subnet for a separate tunnel. Understood, works - everything is fine. Except for one moment.
DNS resolving The dns resolving
subsystem (dns client) uses the file /etc/resolv.conf
, which by default (coincidentally) is a link to /run/systemd/resolve/stub-resolv.conf
.
Starting a process in a network namespace rebinds the link to the file from /etc/netns/myns/resolv.conf
But since I have one tunnel running without a namespace, some of its rules resolvconf is reloaded and updated accordingly /run/systemd/resolve/stub-resolv.conf
, thereby destroying the rebinding for the process running in my myns
namespace.
solution suggested on stackoverfly
nsenter --net=/var/run/netns/test unshare --mount sh -c 'mount --bind /etc/netns/test/resolv.conf /etc/resolv.conf; exec bash'is essentially the same as
ip netns exec myns bash
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question