Question about Network Manager and immutable resolf.conf. (chattr +i)
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Question about Network Manager and immutable resolf.conf. (chattr +i)
So, I was in an interview today, and a question was asked about making the DNS entries persistent even if Network Manager overwrites the resolv.conf file.
I replied you could always make the file immutable after your changes. (Please don't lecture about that NOT being the right way to do it, I'm fully aware...just pointing out possibilities during a discussion.) The engineer who was interviewing me told me that no longer works, as Network Manager can now overwrite them anyway. He was quite adamant about it.
I don't see anywhere where anything has changed about immutable files. I asked if they had a script that checks and reverts it to mutable, and he said no, RH/CentOS does that now.
Is there some flag that NM can be configured to ignore immutable files that I've missed? (FTR, it's been a while since I did any sysadmin work...so I just wanted to make sure I missed something here.)
if you want the job you shouldn't start by criticizing the engineer who interviews you.
while he might be technically wrong (idk), i would agree that what you proposed is an inelegant cludge.
i don't use network-manager if i can avoid it, but generally speaking we are talking about dns resolving which is usually done by another utility.
i use systemd nowadays, and i edit /etc/systemd/resolved.conf.
might be reading into what I said a bit too much...
I didn't criticize the engineer interviewing me at all.
The question was simply how could you do it, and I replied there were several ways (this was specifically in regards to a RHEL/Cent system.) I offered the NetworkManager.conf file first, but he asked what I meant by other ways it could be done, and I rattled off a few. He just was very curt and said that didn't work. He may have been referring to the location having moved in systemd, but he just became very standoffish at that point. I was a little taken aback. Just wondering if there was any more to it than that. (Also, yeah...my first task would be killing NM...)
Last edited by pangalactic; 10-07-2017 at 02:18 AM.
^ very well, bu we're talking about /etc/resolv.conf, and not /etc/hosts as you originally wrote.
Quote:
Originally Posted by pangalactic
but he asked what I meant by other ways it could be done, and I rattled off a few. He just was very curt and said that didn't work. He may have been referring to the location having moved in systemd, but he just became very standoffish at that point.
sounds like he suddenly realized that his knowledge is not superior to yours in that area?
to come back to the actual question: i don't know either.
resolv.conf might be rewritten by various applications, depending on your setup.
there's even a resolvconf.conf file, duh.
i did the 'chattr +i' cludge some years ago and it worked.
but since i use only systemd to connect to the network, my previously described method is sufficient.
aside: my router can also do dns, so i could point the appropriate config file to an internal ip.
Last edited by ondoho; 10-08-2017 at 09:26 AM.
Reason: an explanation seemed necessary after the tshikose edited their post
No worries...I was just wondering if I had missed an update. I'd be willing to bet that, yeah, they have a script/bypass/solution to prevent it built into their config files (which is probably a smart play, frankly...). Appreciate the response.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.