Resolv.conf - Preserving Search Names Upon Reboot
Hello,
As the subject states, I'm adding some additional search names to my /etc/resolv.conf file so I don't have to type out the fully qualified domain name.
I make these changes to the resolv.conf file and everything works correctly. However, when I restart my machine, the file gets reset and my changes are gone.
How do I preserve the changes I make to the resolv.conf file?
Thanks in advance for everyone's time and help, it is greatly appreciated!
About this post
- Posted
- Archived
- Score
- 10 · 100% up
- Kind
- Text
- ID
- 608vft
14 comments
Are you modifying resolv.conf or resolvconf.conf?
See the part about openresolv here https://wiki.archlinux.org/index.php/resolv.conf
/etc/resolv.conf file
That gets overwritten you may want to try openresolv not sure how it works with your setup though.
I use it with pdns / systemd-networking / wpa_supplicant
Are you using NetworkManager? I believe it overwrites resolv.conf, but there's a setting to prevent this. https://wiki.archlinux.org/index.php/resolv.conf#With_NetworkManager
Isn't this something you would add to /etc/hosts?
Unsure, I know you do that on OSX / MacOS.
It's also on Windows...it's in C:\Windows\System32\Drivers\Etc\Hosts
I add local Linux boxes on my Lan to my Windows hosts, for example.
Yeah, if I'm not misunderstanding the post, this is the same thing that I've used /etc/hosts for.
If using KDE, in the KCM for managing network connections, you can add search names for each network connection that will then get populated into resolv.conf.
Not sure if it matters, I am using Gnome DE. And no, not using Network Manager for anything other than connecting to my wifi network.
You can use
/etc/resolv.conf.headand/etc/resolv.conf.tail. If want to add lines to the file, but have it still managed by whatever is rewriting the file.This is a hack but "chattr +i /etc/resolv.conf" will stop anything from modifying the file.
I would suggest against doing this. If you want to manage it manually then just remove resolv.conf (it's a symlink) and recreate it as a standard file with your favourite text editor with the contents you desire. This way NetworkManager will be happy too.
I did say it was a hack. :)