Networking Forums

Networking Forums > Computer Networking > Linux Networking > why are there 2 resolv.conf files?

Reply
Thread Tools Display Modes

why are there 2 resolv.conf files?

 
 
Rick
Guest
Posts: n/a

 
      07-01-2004, 01:14 PM
On my Fedora Core 1, there are 2 resolv.conf files. One is in /etc/ppp/,
which will get written to if usepeerdns in in options, and one in /etc,
which gets written to by dhcp-client script. PPP only seems to read the
/etc/resolv.conf.

Can anyone tell me why this is, or how to get usepeerdns to write to
/etc/resolv.conf?

Any and all help appreciated.
--
Rick

 
Reply With Quote
 
 
 
 
Clifford Kite
Guest
Posts: n/a

 
      07-01-2004, 06:32 PM
Rick <(E-Mail Removed)> wrote:

> On my Fedora Core 1, there are 2 resolv.conf files. One is in /etc/ppp/,
> which will get written to if usepeerdns in in options, and one in /etc,
> which gets written to by dhcp-client script. PPP only seems to read the
> /etc/resolv.conf.


The one in /etc/ppp/resolv.conf is written by pppd. It's up to you or
your distribution to do anything else.

> Can anyone tell me why this is, or how to get usepeerdns to write to
> /etc/resolv.conf?


You can't, pppd only writes to /etc/ppp/resolv.conf.

You could script a workaround in /etc/ppp/ip-up, assuming the format
of /etc/ppp/resolv.conf is compatible with /etc/resolv.conf, by mv'ing
/etc/ppp/resolv.conf to /etc/resolv.conf, or otherwise script to modify
/etc/resolv.conf according to what's in the one pppd writes.

You might also just sym-link /etc/resolv.conf to /etc/ppp/resolv.conf.
But I don't know whether the format of the second is compatible with
the first - I've never used usepeerdns.

You don't need to change /etc/resolv.conf unless you have more than
one ISP. Or if you do, then it should be very, very, very seldom.

--
Clifford Kite Email: "echo xvgr_yvahk-(E-Mail Removed)|rot13"
PPP-Q&A links, downloads: http://ckite.no-ip.net/
/* 97.3% of all statistics are made up. */
 
Reply With Quote
 
Bill Unruh
Guest
Posts: n/a

 
      07-01-2004, 08:21 PM
Clifford Kite <(E-Mail Removed)> writes:

]Rick <(E-Mail Removed)> wrote:

]> On my Fedora Core 1, there are 2 resolv.conf files. One is in /etc/ppp/,
]> which will get written to if usepeerdns in in options, and one in /etc,
]> which gets written to by dhcp-client script. PPP only seems to read the
]> /etc/resolv.conf.

]The one in /etc/ppp/resolv.conf is written by pppd. It's up to you or
]your distribution to do anything else.

The system ONLY uses /etc/resolv.conf to do all of its internet dns lookup.
That is the only file you need.

pppd puts its msdns stuff into /etc/ppp/resolv.conf, because most people
would get very upset to have their /etc/resolv.conf messed up by pppd.
You thus have the info you need in /etc/ppp/resolv.conf if you want to use it.
If you only ever use ppp to connect to any network, you could make
/etc/resolv.conf a link to /etc/ppp/resolv.conf.

Or you could put a program into /etc/ppp/ip-up to transfer the info from
/etc/ppp/resolv.conf to /etc/resolv.conf when ppp comes up, and put another
into /etc/ppp/ip-down to replace the old resolv.conf when ppp finishes.
(This can leave things in a bad state if pppd gets killed for some reason--
by a kill -9 for example)



]> Can anyone tell me why this is, or how to get usepeerdns to write to
]> /etc/resolv.conf?

]You can't, pppd only writes to /etc/ppp/resolv.conf.

]You could script a workaround in /etc/ppp/ip-up, assuming the format
]of /etc/ppp/resolv.conf is compatible with /etc/resolv.conf, by mv'ing
]/etc/ppp/resolv.conf to /etc/resolv.conf, or otherwise script to modify
]/etc/resolv.conf according to what's in the one pppd writes.

]You might also just sym-link /etc/resolv.conf to /etc/ppp/resolv.conf.
]But I don't know whether the format of the second is compatible with
]the first - I've never used usepeerdns.

]You don't need to change /etc/resolv.conf unless you have more than
]one ISP. Or if you do, then it should be very, very, very seldom.

AGreed. Ie, the best idea is probably to take the info in
/etc/ppp/resolv.conf, transfer it to /etc/resolv.conf and forget about it.
Or just forget about using msdns at all, since you seem to already have a
dhcp link anyway.


 
Reply With Quote
 
Rick
Guest
Posts: n/a

 
      07-01-2004, 08:57 PM
On Thu, 01 Jul 2004 20:21:37 +0000, Bill Unruh wrote:

> Clifford Kite <(E-Mail Removed)> writes:
>
> ]Rick <(E-Mail Removed)> wrote:
>
> ]> On my Fedora Core 1, there are 2 resolv.conf files. One is in /etc/ppp/,
> ]> which will get written to if usepeerdns in in options, and one in /etc,
> ]> which gets written to by dhcp-client script. PPP only seems to read the
> ]> /etc/resolv.conf.
>
> ]The one in /etc/ppp/resolv.conf is written by pppd. It's up to you or
> ]your distribution to do anything else.
>
> The system ONLY uses /etc/resolv.conf to do all of its internet dns lookup.
> That is the only file you need.
>
> pppd puts its msdns stuff into /etc/ppp/resolv.conf, because most people
> would get very upset to have their /etc/resolv.conf messed up by pppd.
> You thus have the info you need in /etc/ppp/resolv.conf if you want to use it.
> If you only ever use ppp to connect to any network, you could make
> /etc/resolv.conf a link to /etc/ppp/resolv.conf.
>
> Or you could put a program into /etc/ppp/ip-up to transfer the info from
> /etc/ppp/resolv.conf to /etc/resolv.conf when ppp comes up, and put another
> into /etc/ppp/ip-down to replace the old resolv.conf when ppp finishes.
> (This can leave things in a bad state if pppd gets killed for some reason--
> by a kill -9 for example)
>
>
>
> ]> Can anyone tell me why this is, or how to get usepeerdns to write to
> ]> /etc/resolv.conf?
>
> ]You can't, pppd only writes to /etc/ppp/resolv.conf.
>
> ]You could script a workaround in /etc/ppp/ip-up, assuming the format
> ]of /etc/ppp/resolv.conf is compatible with /etc/resolv.conf, by mv'ing
> ]/etc/ppp/resolv.conf to /etc/resolv.conf, or otherwise script to modify
> ]/etc/resolv.conf according to what's in the one pppd writes.
>
> ]You might also just sym-link /etc/resolv.conf to /etc/ppp/resolv.conf.
> ]But I don't know whether the format of the second is compatible with
> ]the first - I've never used usepeerdns.
>
> ]You don't need to change /etc/resolv.conf unless you have more than
> ]one ISP. Or if you do, then it should be very, very, very seldom.
>
> AGreed. Ie, the best idea is probably to take the info in
> /etc/ppp/resolv.conf, transfer it to /etc/resolv.conf and forget about it.
> Or just forget about using msdns at all, since you seem to already have a
> dhcp link anyway.


The computer that is having this problem is a latop. I use wifi with it at
home, but I have to dial on the road. I think I am just going to copy the
/etc/ppp/resolv over the /etc/resolv.conf either manually or by script
when I use ppp. The DHCP-client script will overwrite it by itself.

Thanks for the help, all.
--
Rick

 
Reply With Quote
 
Marc Schwartz
Guest
Posts: n/a

 
      07-01-2004, 09:10 PM
On Thu, 01 Jul 2004 20:21:37 +0000, Bill Unruh wrote:

> Clifford Kite <(E-Mail Removed)> writes:
>
> ]Rick <(E-Mail Removed)> wrote:
>
> ]> On my Fedora Core 1, there are 2 resolv.conf files. One is in /etc/ppp/,
> ]> which will get written to if usepeerdns in in options, and one in /etc,
> ]> which gets written to by dhcp-client script. PPP only seems to read the
> ]> /etc/resolv.conf.
>
> ]The one in /etc/ppp/resolv.conf is written by pppd. It's up to you or
> ]your distribution to do anything else.
>
> The system ONLY uses /etc/resolv.conf to do all of its internet dns lookup.
> That is the only file you need.
>
> pppd puts its msdns stuff into /etc/ppp/resolv.conf, because most people
> would get very upset to have their /etc/resolv.conf messed up by pppd.
> You thus have the info you need in /etc/ppp/resolv.conf if you want to use it.
> If you only ever use ppp to connect to any network, you could make
> /etc/resolv.conf a link to /etc/ppp/resolv.conf.
>
> Or you could put a program into /etc/ppp/ip-up to transfer the info from
> /etc/ppp/resolv.conf to /etc/resolv.conf when ppp comes up, and put another
> into /etc/ppp/ip-down to replace the old resolv.conf when ppp finishes.
> (This can leave things in a bad state if pppd gets killed for some reason--
> by a kill -9 for example)
>
>
>
> ]> Can anyone tell me why this is, or how to get usepeerdns to write to
> ]> /etc/resolv.conf?
>
> ]You can't, pppd only writes to /etc/ppp/resolv.conf.
>
> ]You could script a workaround in /etc/ppp/ip-up, assuming the format
> ]of /etc/ppp/resolv.conf is compatible with /etc/resolv.conf, by mv'ing
> ]/etc/ppp/resolv.conf to /etc/resolv.conf, or otherwise script to modify
> ]/etc/resolv.conf according to what's in the one pppd writes.
>
> ]You might also just sym-link /etc/resolv.conf to /etc/ppp/resolv.conf.
> ]But I don't know whether the format of the second is compatible with
> ]the first - I've never used usepeerdns.
>
> ]You don't need to change /etc/resolv.conf unless you have more than
> ]one ISP. Or if you do, then it should be very, very, very seldom.
>
> AGreed. Ie, the best idea is probably to take the info in
> /etc/ppp/resolv.conf, transfer it to /etc/resolv.conf and forget about it.
> Or just forget about using msdns at all, since you seem to already have a
> dhcp link anyway.



I am coming into this thread late, so apologies if anything I have here is
redundant or not appropriate.

There was a thread on the Fedora e-mail list
(http://www.redhat.com/archives/fedor.../msg07831.html) which
contained a script called /etc/ppp/ip-up.local, which is referred to in
'man pppd' and has seemed to be helpful:

#!/bin/bash
# /etc/ppp/ip-up.local

PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH

echo "Created by pppd and $0" > /etc/resolv.conf
echo "nameserver ${DNS1}" >> /etc/resolv.conf
echo "nameserver ${DNS2}" >> /etc/resolv.conf
chmod go+r /etc/resolv.conf


Reading through the above specific e-mail and thread may may be helpful to
folks for context.

HTH,

Marc Schwartz

 
Reply With Quote
 
Clifford Kite
Guest
Posts: n/a

 
      07-02-2004, 02:43 AM
Marc Schwartz <(E-Mail Removed)> wrote:

> There was a thread on the Fedora e-mail list
> (http://www.redhat.com/archives/fedor.../msg07831.html) which
> contained a script called /etc/ppp/ip-up.local, which is referred to in
> 'man pppd' and has seemed to be helpful:


> #!/bin/bash
> # /etc/ppp/ip-up.local
>
> PATH=/sbin:/usr/sbin:/bin:/usr/bin
> export PATH
>
> echo "Created by pppd and $0" > /etc/resolv.conf
> echo "nameserver ${DNS1}" >> /etc/resolv.conf
> echo "nameserver ${DNS2}" >> /etc/resolv.conf
> chmod go+r /etc/resolv.conf


A slight variation on this could also provide for a permanent resolver
options configuration. One way would be to place just the options in
a file, say /etc/resolv.opts, and use the above script with the first
line replaced by "cp -a /etc/resolv.opts /etc/resolv.conf" so that
the options would be retained as well as the DNS nameservers added.
I think the last line could then be omitted (or replaced by the first
line but using ">>" instead of ">").

Since it is a comment, the first line should really begin with a "#",
but perhaps the resolver library just ignores something it doesn't
understand at all.

There are also distributions that don't use /etc/ppp/ip-up.local, and
the body of the script then should be a part of /etc/ppp/ip-up.

--
Clifford Kite Email: "echo xvgr_yvahk-(E-Mail Removed)|rot13"
PPP-Q&A links, downloads: http://ckite.no-ip.net/
 
Reply With Quote
 
Rick
Guest
Posts: n/a

 
      07-02-2004, 04:20 AM
On Thu, 01 Jul 2004 21:43:09 -0500, Clifford Kite wrote:

> Marc Schwartz <(E-Mail Removed)> wrote:
>
>> There was a thread on the Fedora e-mail list
>> (http://www.redhat.com/archives/fedor.../msg07831.html) which
>> contained a script called /etc/ppp/ip-up.local, which is referred to in
>> 'man pppd' and has seemed to be helpful:

>
>> #!/bin/bash
>> # /etc/ppp/ip-up.local
>>
>> PATH=/sbin:/usr/sbin:/bin:/usr/bin
>> export PATH
>>
>> echo "Created by pppd and $0" > /etc/resolv.conf
>> echo "nameserver ${DNS1}" >> /etc/resolv.conf
>> echo "nameserver ${DNS2}" >> /etc/resolv.conf
>> chmod go+r /etc/resolv.conf

>
> A slight variation on this could also provide for a permanent resolver
> options configuration. One way would be to place just the options in
> a file, say /etc/resolv.opts, and use the above script with the first
> line replaced by "cp -a /etc/resolv.opts /etc/resolv.conf" so that
> the options would be retained as well as the DNS nameservers added.
> I think the last line could then be omitted (or replaced by the first
> line but using ">>" instead of ">").
>
> Since it is a comment, the first line should really begin with a "#",
> but perhaps the resolver library just ignores something it doesn't
> understand at all.
>
> There are also distributions that don't use /etc/ppp/ip-up.local, and
> the body of the script then should be a part of /etc/ppp/ip-up.


Thanks, I'll take a look at the thread. WOuld the above script prevent
DHCP-client script from overwriting resolv.conf? This needs to happen when
using my home lan.
--
Rick

 
Reply With Quote
 
Rick
Guest
Posts: n/a

 
      07-02-2004, 04:38 AM
On Thu, 01 Jul 2004 21:43:09 -0500, Clifford Kite wrote:

> Marc Schwartz <(E-Mail Removed)> wrote:
>
>> There was a thread on the Fedora e-mail list
>> (http://www.redhat.com/archives/fedor.../msg07831.html) which
>> contained a script called /etc/ppp/ip-up.local, which is referred to in
>> 'man pppd' and has seemed to be helpful:

>
>> #!/bin/bash
>> # /etc/ppp/ip-up.local
>>
>> PATH=/sbin:/usr/sbin:/bin:/usr/bin
>> export PATH
>>
>> echo "Created by pppd and $0" > /etc/resolv.conf
>> echo "nameserver ${DNS1}" >> /etc/resolv.conf
>> echo "nameserver ${DNS2}" >> /etc/resolv.conf
>> chmod go+r /etc/resolv.conf

>
> A slight variation on this could also provide for a permanent resolver
> options configuration. One way would be to place just the options in
> a file, say /etc/resolv.opts, and use the above script with the first
> line replaced by "cp -a /etc/resolv.opts /etc/resolv.conf" so that
> the options would be retained as well as the DNS nameservers added.
> I think the last line could then be omitted (or replaced by the first
> line but using ">>" instead of ">").
>
> Since it is a comment, the first line should really begin with a "#",
> but perhaps the resolver library just ignores something it doesn't
> understand at all.
>
> There are also distributions that don't use /etc/ppp/ip-up.local, and
> the body of the script then should be a part of /etc/ppp/ip-up.


I looked at the thread, and it is was well stated here, I wonder why
userpeerdns just doesn't write to /etc/resolv.conf? I also found that a
defaultroute was setup that keeps me from going from modem/ppp back to an
without a restart, or at least figuring out out how to clear the default
route. Of course, since this is a laptop, I would probably be restarting
anyway.

Thanks for the help.
--
Rick

 
Reply With Quote
 
Clifford Kite
Guest
Posts: n/a

 
      07-02-2004, 01:10 PM
Rick <(E-Mail Removed)> wrote:
> On Thu, 01 Jul 2004 21:43:09 -0500, Clifford Kite wrote:


>> There are also distributions that don't use /etc/ppp/ip-up.local, and
>> the body of the script then should be a part of /etc/ppp/ip-up.


> I looked at the thread, and it is was well stated here, I wonder why
> userpeerdns just doesn't write to /etc/resolv.conf? I also found that a
> defaultroute was setup that keeps me from going from modem/ppp back to an
> without a restart, or at least figuring out out how to clear the default
> route. Of course, since this is a laptop, I would probably be restarting
> anyway.


As to why it doesn't write directly to /etc/resolv.conf, a minor reason is
that resolv.conf was conceived in a era when laptops and PPP didn't exist.
Whether it's does that now depends on what the pppd maintainer is willing
to do. I happen to side with him on this issue.

Supplying DNS nameserver IP addresses via PPP IPCP negotiation is a MS
hack, and implementing it in pppd is as far as the maintainer is willing
to go since you can script a solution to change resolv.conf. One could
ask "why doesn't MS implement an equivalent to ip-up and ip-down?" which
can be scripted for other special needs as well? Moreover, if you wanted
resolver options then pppd would also have to provide options for those.

Something seems to be left out of the remark about the PPP default route.
However, the default route should go away when the PPP link is terminated
in a half-way decent manner. Termination with "killall -KILL pppd" is
a brutal last resort not a a half-way decent manner, but "killall -TERM
pppd" should take down the PPP interface, and all the PPP routing should
go away.

--
Clifford Kite Email: "echo xvgr_yvahk-(E-Mail Removed)|rot13"
PPP-Q&A links, downloads: http://ckite.no-ip.net/
/* I hear and I forget. I see and I remember. I do and I understand.
--Confucius, 551-479 BC */
 
Reply With Quote
 
Rick
Guest
Posts: n/a

 
      07-02-2004, 05:06 PM
On Fri, 02 Jul 2004 08:10:07 -0500, Clifford Kite wrote:

> Rick <(E-Mail Removed)> wrote:
>> On Thu, 01 Jul 2004 21:43:09 -0500, Clifford Kite wrote:

>
>>> There are also distributions that don't use /etc/ppp/ip-up.local, and
>>> the body of the script then should be a part of /etc/ppp/ip-up.

>
>> I looked at the thread, and it is was well stated here, I wonder why
>> userpeerdns just doesn't write to /etc/resolv.conf? I also found that a
>> defaultroute was setup that keeps me from going from modem/ppp back to an
>> without a restart, or at least figuring out out how to clear the default
>> route. Of course, since this is a laptop, I would probably be restarting
>> anyway.

>
> As to why it doesn't write directly to /etc/resolv.conf, a minor reason is
> that resolv.conf was conceived in a era when laptops and PPP didn't exist.
> Whether it's does that now depends on what the pppd maintainer is willing
> to do. I happen to side with him on this issue.
>
> Supplying DNS nameserver IP addresses via PPP IPCP negotiation is a MS
> hack, and implementing it in pppd is as far as the maintainer is willing
> to go since you can script a solution to change resolv.conf. One could
> ask "why doesn't MS implement an equivalent to ip-up and ip-down?" which
> can be scripted for other special needs as well? Moreover, if you wanted
> resolver options then pppd would also have to provide options for those.
>
> Something seems to be left out of the remark about the PPP default route.
> However, the default route should go away when the PPP link is terminated
> in a half-way decent manner. Termination with "killall -KILL pppd" is
> a brutal last resort not a a half-way decent manner, but "killall -TERM
> pppd" should take down the PPP interface, and all the PPP routing should
> go away.


Thanks. I think I'll be able to automate this stuff now.
--
Rick

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
resolv.conf is empty ? subrato Linux Networking 7 02-06-2006 02:23 PM
dhcpd.conf, resolv.conf and the search directive Andy Richardson Linux Networking 4 07-13-2005 08:23 AM
resolv.conf usage Bit Twister Linux Networking 3 11-16-2004 04:00 AM
resolv.conf Stephen Speicher Linux Networking 5 12-10-2003 09:00 AM
NIS, DNS and resolv.conf ncrfgs Linux Networking 2 10-02-2003 05:09 PM



1 2 3 4 5 6 7 8 9 10 11