configure that /etc/resolv.conf won't be modified after restart
Solution 1
The right way to do this these days is, I believe, to add the DNS information to your /etc/conf.d/net
file, so that the rc scripts manage your /etc/resolv.conf
file correctly.
Add:
dns_servers="8.8.8.8 8.8.4.4"
to that file and you should be good to go. If you need other resolver settings, look at the net.example
file in /usr/share/doc/openrc-*/
. Some of the available settings:
dns_domain
dns_search
dns_options
dns_sortlist
Solution 2
Try:
chattr +i /etc/resolv.conf
If you will ever need to change resolv.conf just remove immutable flag by:
chattr -i /etc/resolv.conf
Related videos on Youtube
Comments
-
ufk over 1 year
I have Gentoo Linux amd64 installed on one of my computers. I have a static IP configured at /etc/conf.d/net:
auto_eth0="true" config_eth0="192.168.1.2/24" routes_eth0="default via 192.168.1.1" enable_ipv6_eth0="false"
I manually edited /etc/resolv.conf and added google dns servers. the problem is that whenever I restart my server /etc/resolv.conf gets wiped out. I tired setting 'chmod a-w /etc/resolv.conf' and it didn't work but i actually don't really like that method anyhow.
how can I let gentoo know that I don't want /etc/resolv.conf to be modified ?
thanks!
-
Bram about 12 yearsWhile this might prevent whatever process overwriting this file it does not really address the root of the issue. @Mat's answer seems to be the better approach.
-
mzmultics about 12 yearsThat's true, @Mat's approach is better.
-
Nitin almost 12 yearsit's working..............