Stop Fedora from overwriting /etc/resolv.conf

20 Mar, 2011  |  Written by  |  under Uncategorized

I run my own local DNS server for DNS caching, and handling the local DHCP domains.

As my main firewall/router doesn’t move around (and thus doesn’t need to change it’s DNS), I prefer to hard code my /etc/resolv.conf file to add my local domains and DNS server. However, Fedora overwrites the /etc/resolv.conf file whenever the network boots.

Found an easy fix to this today. Add the following line to every ifcfg-* file in /etc/sysconfig/network-scripts

PEERDNS=no

The PEERDNS line causes the dhclient script to not find the DNS server for that network link and add it to resolv.conf, so it leaves the file alone.

Here’s my resolv.conf:

search home
; Local machine's nameserver
nameserver 127.0.0.1
; Telstra's nameservers in case mine is down
nameserver 61.9.134.49
nameserver 61.9.194.49
nameserver 61.9.207.1

No Responses so far | Have Your Say!

Leave a Feedback

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>