Can I change DNS resolution settings on a per-group or per-user basis on Linux 3.x?

I would like different groups to use different DNS servers and (if possible) different static entries (like those in /etc/hosts). Is there a way to configure this?

  • 1
    Namespaces could (conceivably) solve both of those, though it would be non-trivial. – Bandrami Mar 17 '15 at 9:45
  • You can do this if your users and groups are in well-partitioned IP address ranges ("split DNS") but I can't see a way of doing this per user/group on a single machine. – roaima Mar 17 '15 at 10:01
  • There's just too many places where the lines blur on a single machine - one of these is the DNS cache. – Sobrique Mar 17 '15 at 10:03

Not trivially. Your DNS configuration underpins a lot of things with your system, and so context switching name resolution gets messy fast.

Imagine if you will - I send an email. I 'send' the mail to a particular remote server (resolved against my version of DNS) and it gets there.

But then I do the same, and pipe it to mail and localhost figures out where to relay it based on it's own mail exchange records.

The best you could do is virtualise and set up 'group' servers with specific DNS configs.

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.