why are there 2 resolv.conf files? - Redhat

This is a discussion on why are there 2 resolv.conf files? - Redhat ; 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 ...

+ Reply to Thread
Results 1 to 11 of 11

Thread: why are there 2 resolv.conf files?

  1. why are there 2 resolv.conf files?

    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


  2. Re: why are there 2 resolv.conf files?

    In article , Rick 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.
    >
    > Can anyone tell me why this is, or how to get usepeerdns to write to
    > /etc/resolv.conf?


    When connected, look at /etc/resolv.conf. It will change (depending
    on whether you are connected or not and what/how you get you
    nameservers, either by coding them manually or automatically).

    /etc/resolv.conf is the one read, but it is changed.

    If worse comes to worst, you can always just edit /etc/resolv.conf
    (which I sometimes do ... PPP, my ISP automatically sends NS
    IP addresses, sometimes/often it only sends one, duplicated,
    instead of the IP addresses of the two usable nameservers and
    the one it sends is the nameserver which is not the best, so
    sometimes, if I have problems resolving things, I edit resolv.conf -
    you could do it with a script) (the edit will be lost when you
    go offline and resolv.conf is rewritten).

  3. Re: why are there 2 resolv.conf files?

    Rick 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-ccc@ri1.arg|rot13"
    PPP-Q&A links, downloads: http://ckite.no-ip.net/
    /* 97.3% of all statistics are made up. */

  4. Re: why are there 2 resolv.conf files?

    Clifford Kite writes:

    ]Rick 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.



  5. Re: why are there 2 resolv.conf files?

    On Thu, 01 Jul 2004 20:21:37 +0000, Bill Unruh wrote:

    > Clifford Kite writes:
    >
    > ]Rick 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


  6. Re: why are there 2 resolv.conf files?

    On Thu, 01 Jul 2004 20:21:37 +0000, Bill Unruh wrote:

    > Clifford Kite writes:
    >
    > ]Rick 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


  7. Re: why are there 2 resolv.conf files?

    Marc Schwartz 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-ccc@ri1.arg|rot13"
    PPP-Q&A links, downloads: http://ckite.no-ip.net/

  8. Re: why are there 2 resolv.conf files?

    On Thu, 01 Jul 2004 21:43:09 -0500, Clifford Kite wrote:

    > Marc Schwartz 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


  9. Re: why are there 2 resolv.conf files?

    On Thu, 01 Jul 2004 21:43:09 -0500, Clifford Kite wrote:

    > Marc Schwartz 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


  10. Re: why are there 2 resolv.conf files?

    Rick 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-ccc@ri1.arg|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 */

  11. Re: why are there 2 resolv.conf files?

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

    > Rick 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 to Thread