Bug 304611 - resolv.conf hardwired in /sbin/dhclient-script and network-functions
Summary: resolv.conf hardwired in /sbin/dhclient-script and network-functions
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: 24
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Lukáš Nykrýn
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-09-25 08:31 UTC by Thomas Schweikle
Modified: 2017-08-08 11:38 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-08-08 11:38:48 UTC
Type: ---
Embargoed:


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

Description Thomas Schweikle 2007-09-25 08:31:38 UTC
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 18:05:46 UTC
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 10:05:34 UTC
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 13:08:26 UTC
Provide unified diffs (diff -u), not contextual diffs.  Attach them to the bug
report.

Comment 4 Thomas Schweikle 2007-10-12 09:57:16 UTC
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 14:02:43 UTC
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 14:29:19 UTC
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 05:24:45 UTC
This is the same for Fedora 8 and 9.

Comment 8 Bug Zapper 2009-06-09 22:52:13 UTC
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 14:49:47 UTC
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 21:07:43 UTC
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 17:47:34 UTC
(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 12:06:34 UTC
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 07:14:52 UTC
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 22:57:28 UTC
dhclient-4.2.0-16.P2.fc14

Comment 15 Chris Noffsinger 2011-06-10 20:53:28 UTC
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 22:08:54 UTC
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 09:22:49 UTC
still a problem in current Rawhide

Comment 18 Lukáš Nykrýn 2015-12-07 07:55:54 UTC
Can't you just set PEERDNS=no in your ifcfg files?

Comment 19 Jan Kurik 2016-02-24 15:53:14 UTC
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

Comment 20 Fedora End Of Life 2017-07-25 18:27:40 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. 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 EOL if it remains open with a Fedora  'version'
of '24'.

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.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 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, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

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.

Comment 21 Fedora End Of Life 2017-08-08 11:38:48 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 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. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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