Bug 304611 - resolv.conf hardwired in /sbin/dhclient-script and network-functions
resolv.conf hardwired in /sbin/dhclient-script and network-functions
Status: NEW
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
24
All Linux
low Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-25 04:31 EDT by Thomas Schweikle
Modified: 2016-02-24 10:53 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-16 18:08:51 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Make file to which "/etc/resolv.conf" is written a configurable option. (1.81 KB, patch)
2007-10-12 05:57 EDT, Thomas Schweikle
no flags Details | Diff

  None (edit)
Description Thomas Schweikle 2007-09-25 04:31:38 EDT
Description of problem:
the file /etc/resolv.conf is hardwired in /sbin/dhclient-script and /etc/
sysconfig/network-scripts/network-functions. It should be a configurable 
option, defaulting to "/etc/resolv.conf".

This would allow for dynamicly assigned addresses, while being able to set up 
my own DNS, resolving against "localhost" only.

Version-Release number of selected component (if applicable):
dhclient-3.0.5-40.fc7

How reproducible:
always

Steps to Reproduce:
1. install dhclient, dnsmasq
2. setup your own DNS using dnsmasq, connect to a network your
   system is assigned a dynamic adress changing every hour.
3. watch "/etc/resolv.conf" overwritten every hour, rendering
   your local DNS unused, breaking your carefully designed setup.
  
Actual results:
As expected, since "/etc/resolv.conf" is hardwired.

Expected results:
With a configurable position and name, dhclient would write "/etc/resolv.conf" 
to say "/etc/resolv.dnsmasq", leaving "/etc/resolv.conf" untouched, allowing 
for a local DNS, resolving local names.

Additional info:
diff network-functions network-fn-configurable:
9a10,12
> [ -f "/etc/sysconfig/dhclient" ] && . /etc/sysconfig/dhclient
> [ -z "$resolvconf" ] && resolvconf=/etc/resolv.conf
> 
266c269
<     if ! grep search /etc/resolv.conf >/dev/null 2>&1; then
---
>     if ! grep search $resolvconf >/dev/null 2>&1; then
270c273
<               cat /etc/resolv.conf > $rsctmp
---
>               cat $resolvconf > $rsctmp
404c407
< # Invoke this when /etc/resolv.conf has changed:
---
> # Invoke this when /etc/resolv has changed:
407c410
<     s=`/bin/grep '^[\ \       ]*option' /etc/resolv.conf 2>/dev/null`;
---
>     s=`/bin/grep '^[\ \       ]*option' $resolvconf 2>/dev/null`;
434c437
<     (echo "$s" > /etc/resolv.conf;) >/dev/null 2>&1;
---
>     (echo "$s" > $resolvconf;) >/dev/null 2>&1;
437,438c440,441
<       [ -x /sbin/restorecon ] && /sbin/restorecon /etc/resolv.conf >/dev/
null 2>&1 # reset the correct context
<       logger -p local7.notice -t "NET" -i "$0 : updated /etc/resolv.conf";
---
>       [ -x /sbin/restorecon ] && /sbin/restorecon $resolvconf >/dev/null 
2>&1 # reset the correct context
>       logger -p local7.notice -t "NET" -i "$0 : updated $resolvconf";

diff dhclient-script dhclient-script-var:
96c96
< . /etc/sysconfig/network-scripts/network-functions
---
> . /etc/sysconfig/network-scripts/network-fn-var

The configuration file "/etc/sysconfig/dhclient" holds:
resolvconf=/etc/resolv.dnsmasq
Comment 1 David Cantrell 2007-10-08 14:05:46 EDT
You can already provide your own DNS override via /etc/dhclient.conf.  Use the
supersede domain-name and supersede domain-name-servers directives in
dhclient.conf and you can override whatever the DHCP lease provides.  See
dhclient.conf(5) for more details.
Comment 2 Thomas Schweikle 2007-10-09 06:05:34 EDT
No, no, no. That is not the same!

If I superseed domain-name-servers, I provide a *fixed* set of domain name 
servers. If I superseed domain-name, I provide a *fixed* domain name. This 
fixed name is then entered into "/etc/resolv.conf". But what, when the provider 
changes the domain names, assuming all users use dhcp for getting there domain 
name servers (and in some cases there domain name)?

The superseeded domain name servers get further entered into resolv.conf making 
you wonder why no dns query does give back the an address for say "redhat.com".

Again: assume you are running your own dns server, assume this being dnsmasq; 
assume further your provider gives back 10.0.0.1 and 10.0.0.2 for his upstream 
dns servers and "example.home" for the domain name. Now resolv.conf is set to

search example.home
nameserver 10.0.0.1
nameserver 10.0.0.2

The system will query the providers dns, but not your own, localy running dns. 
This would only be done if resolv.conf holding

search example.home
nameserver 127.0.0.1

superseeding domain-name-servers could overcome this problem, but in this case: 
what servers should your local dns query for names not known to it?

OK, I can copy the setup resolv.conf to a resolv.localdns and make my local dns 
read this copied version, setting resolv.conf to point to my localy running 
dns. This will work --- until the lease is renewed. After that my resolv.conf 
is *overwritten* with the data given by the provider, rendering my local dns 
unused again!

If my provider handles me a new set of dns servers with every renew of the 
lease, I will have to copy resolv.conf every time I receive a new lease. If 
this is done all 900 seconds, you are in some trouble. But this is normal in a 
variety of networks, notably WLAN.

Superseeding domain-name-servers and domain-name does not help out. The only 
thing helping would be to write what the provider gives back for domain-name-
servers and domain-name to an other file than "/etc/resolv.conf".

AFAIK there is no way doing this with the provided scripts (and there is no way 
setting this up from dhclient.conf). These *will* in all cases write to "/etc/
resolv.conf", making a local dns useless if a lease is renewed within a short 
period of time.

The change is simple: make the file resolve data is written to configurable. I 
provided diffs doing this, solving the problem.
Comment 3 David Cantrell 2007-10-09 09:08:26 EDT
Provide unified diffs (diff -u), not contextual diffs.  Attach them to the bug
report.
Comment 4 Thomas Schweikle 2007-10-12 05:57:16 EDT
Created attachment 225341 [details]
Make file to which "/etc/resolv.conf" is written a configurable option.

The unified diff, as requested.
Comment 5 David Cantrell 2007-10-12 10:02:43 EDT
Reassigning to initscripts, which is the component that owns
/etc/sysconfig/network-scripts/network-functions (see rpm -qf).
Comment 6 Bug Zapper 2008-05-14 10:29:19 EDT
This message is a reminder that Fedora 7 is nearing the end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 7. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '7'.

Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 7's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 7 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug. If you are unable to change the version, please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. If possible, it is recommended that you try the newest available Fedora distribution to see if your bug still exists.

Please read the Release Notes for the newest Fedora distribution to make sure it will meet your needs:
http://docs.fedoraproject.org/release-notes/

The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 7 Thomas Schweikle 2008-05-15 01:24:45 EDT
This is the same for Fedora 8 and 9.
Comment 8 Bug Zapper 2009-06-09 18:52:13 EDT
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 9 Bill Nottingham 2009-06-10 10:49:47 EDT
I really don't think this is appropriate for Fedora - this is far outside of the normal usage cases.b
Comment 10 Thomas Schweikle 2009-06-11 17:07:43 EDT
Could be quite common if you are using virtualisation technologies like VMware, Virtual Box or Qemu. Your local host assigns via DHCP local addresses to your virtual machines. Quite a bit a buggy way to assign static addresses to all VMs you create on the fly.

Would be nice to have some way to configure a local DNS to resolve these local VMs to have them accessible via your host only network with names, not numbers!

At the moment configuring this is for freaks and cracks really knowing what they are doing. But not for the average user. Since Linux likes to go for the average user and the changes involved are easy to make --- why not??
Comment 11 Till Maas 2010-01-04 12:47:34 EST
(In reply to comment #9)
> I really don't think this is appropriate for Fedora - this is far outside of
> the normal usage cases.b  

Please reconsider this. I have the same problem. I have a local dnsmasq and bind for my virtual machines, but my "ISP" forces me to use dhcp. Therefore I, too, need a way to get the dhcp-data, but not have dhclient mess with /etc/resolv.conf.
Comment 12 Bug Zapper 2010-11-04 08:06:34 EDT
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 13 Bug Zapper 2010-12-05 02:14:52 EST
Fedora 12 changed to end-of-life (EOL) status on 2010-12-02. Fedora 12 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 14 Till Maas 2010-12-17 17:57:28 EST
dhclient-4.2.0-16.P2.fc14
Comment 15 Chris Noffsinger 2011-06-10 16:53:28 EDT
Hey Till Maas if you want a workaround, just set resolv.conf the way you want it and make it immutable:

chattr +i /etc/resolv.conf

then if you need to edit it to unlock it:

chattr -i /etc/resolv.conf
Comment 16 Fedora End Of Life 2012-08-16 18:08:54 EDT
This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 17 Till Maas 2015-12-06 04:22:49 EST
still a problem in current Rawhide
Comment 18 Lukáš Nykrýn 2015-12-07 02:55:54 EST
Can't you just set PEERDNS=no in your ifcfg files?
Comment 19 Jan Kurik 2016-02-24 10:53:14 EST
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Note You need to log in before you can comment on or make changes to this bug.