Skip to content

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!

10 points14 comments
Open on Reddit
About this post
Posted
Archived
Score
10 · 100% up
Kind
Text
ID
608vft

Author

208
posts
484
comments
6
media
View profile

14 comments

Isn't this something you would add to /etc/hosts?

1 points

Unsure, I know you do that on OSX / MacOS.

1 points

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.

1 points

Yeah, if I'm not misunderstanding the post, this is the same thing that I've used /etc/hosts for.

1 points

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.

1 points

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.

1 points

You can use /etc/resolv.conf.head and /etc/resolv.conf.tail. If want to add lines to the file, but have it still managed by whatever is rewriting the file.

1 points

This is a hack but "chattr +i /etc/resolv.conf" will stop anything from modifying the file.

0 points

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.

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.