Gentoo Archives: gentoo-user

From: Joshua Murphy <poisonbl@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] ppp-gentoo woes cont'd [SOLVED-sorta]
Date: Thu, 29 Mar 2012 03:04:00
Message-Id: CAOTuDKqJ=vja9J-YSk=iFmTRpAEEQiDuFXQ=ZUaXDBU9H4KdpA@mail.gmail.com
In Reply to: Re: [gentoo-user] ppp-gentoo woes cont'd [SOLVED-sorta] by Maxim Wexler
1 On Wed, Mar 28, 2012 at 4:05 PM, Maxim Wexler <maxim.wexler@×××××.com> wrote:
2 >>>
3 >>>> with ppp connections you are not using a dhcp client, pppd gets the
4 >>>> nameserver ip addressess as part of the connection negotiation (if
5 >>>> peerdns is set) and the aforemetioned script in
6 >>>> /etc/ppp/ip-up.d/40-dns.sh writes those to /etc/resolv.conf
7 >
8 > This is at the top of /etc/resolv.conf
9 > # Generated by dhcpcd
10 > # /etc/resolv.conf.head can replace this line
11 > # /etc/resolv.conf.tail can replace this line
12 >
13 > But according to /var/log/messages:
14 >
15 > Mar 28 13:24:01 lumby pppd[16825]: primary   DNS address 75.153.176.1
16 > Mar 28 13:24:01 lumby pppd[16825]: secondary DNS address 75.153.176.9
17 >
18 > But whatever is in resolv.conf is overwritten with blanks AFTER I
19 > connect. Which creates this odd situation where I can ping numbers,
20 > ie, 8.8.8.8 but not com, net, org etc.
21 >
22 > Once I "connect" I have to echo the DNS addresses into resolv.conf
23 > before I can reach anything.
24 >
25 > Also, I notice whenever I set up a route to my router those numbers
26 > get wiped. Is that the default behavio(u)r?. NB, I have nothing in the
27 > way of services other than ppp configured at all. Maybe later after I
28 > sort it all out I'll rig up something automatic.
29 >
30 > Thanks for everybody's hlp
31 >
32 > MW
33 >
34 > ps:  according to /etc/ppp/ip-up.d/40-dns.sh:
35 >
36 > -------------------------------------------------------------------------------------------------------------------------------
37 >
38 > #!/bin/sh
39 >
40 > # Handle resolv.conf generation when usepeerdns pppd option is being used.
41 > # Used parameters and environment variables:
42 > # $1 - interface name (e.g. ppp0)
43 > # $USEPEERDNS - set if user specified usepeerdns
44 > # $DNS1 and $DNS2 - DNS servers reported by peer
45 >
46 > if [ "$USEPEERDNS" ]; then
47 >
48 >        if [ -x /sbin/resolvconf ]; then
49 >                {
50 >                        echo "# Generated by ppp for $1"
51 >                        [ -n "$DNS1" ] && echo "nameserver $DNS1"
52 >                        [ -n "$DNS2" ] && echo "nameserver $DNS2"
53 >                } | /sbin/resolvconf -a "$1"
54 >        else
55 >                # add the server supplied DNS entries to /etc/resolv.conf
56 >                # (taken from debian's 0000usepeerdns)
57 >
58 >                # follow any symlink to find the real file
59 >                REALRESOLVCONF=$(readlink -f /etc/resolv.conf)
60 >
61 >                if [ "$REALRESOLVCONF" != "/etc/ppp/resolv.conf" ]; then
62 >
63 >                        # merge the new nameservers with the other options from the old configuration
64 >                        {
65 >                                grep --invert-match '^nameserver[[:space:]]' $REALRESOLVCONF
66 >                                cat /etc/ppp/resolv.conf
67 >                        } > $REALRESOLVCONF.tmp
68 >
69 >                        # backup the old configuration and install the new one
70 >                        cp -dpP $REALRESOLVCONF $REALRESOLVCONF.pppd-backup
71 >                        mv $REALRESOLVCONF.tmp $REALRESOLVCONF
72 >
73 >                        # correct permissions
74 >                        chmod 0644 /etc/resolv.conf
75 >                        chown root:root /etc/resolv.conf
76 >                fi
77 >        fi
78 >
79 > fi
80 >
81 > --------------------------------------------------------------------------------------------------------------------------------
82 >
83 > the software is aware of two resolv.confs, one under /etc/, one under
84 > /etc/ppp. /etc/ppp/resolv.conf is correctly filled in, but the other
85 > is wiped. Can anyone see why?
86 >
87 > MW
88 >
89
90 If I recall, this was my guess as the real problem you were running
91 into. As for what's making the last change to /etc/resolv.conf...
92 aside from kernel-level auditing, there's nothing I'm aware of that
93 can tell you. Since /etc/ppp/resolv.conf is correct but
94 /etc/resolv.conf isn't, one of three things is happening:
95
96 a) 40-dns.sh is running, making the changes it needs to, and they're
97 being promptly overwritten by something else... unlikely and
98 excessively hard to diagnose,
99 b) 40-dns.sh is running but isn't actually updating /etc/resolv.conf
100 properly... it looks fine, matches the default I have here (which
101 works on my pppoe setup at least), but could happen if one of the
102 assumptions it makes is wrong (or if, say, if [ "$USEPEERDNS" ]; is
103 coming up false), or...
104 c) 40-dns.sh is not even running, meaning /etc/resolv.conf never gets
105 updated by pppd... this would have been my first guess, except for the
106 fact that /etc/ppp/ip-up just outright sources all *.sh in
107 /etc/ppp/ip-up.d/ so... shouldn't be that (and I saved myself from
108 looking a bit silly, checking that beforehand).
109
110 The first step to tracking it down would probably be stepping through
111 that script and comparing it to your situation. Does
112 /etc/resolv.conf.pppd-backup exist? If so, it *is* at least making
113 changes to the original. I recall usepeerdns is set, so is
114 /sbin/resolvconf an existing, executable, file? If not, and since they
115 differ, I suspect it's failing somewhere in merging them. You might
116 add some echo calls writing out to a file in /tmp to 40-dns.sh so you
117 can track what, if anything, it does (and what values it's using in
118 the process).
119
120 My best guess, if it is 'a', is that something in the style of
121 networkmanager or the like, if you're running any such thing, is the
122 culprit, but that's pulled pretty solidly from thin air here.
123
124 --
125 Poison [BLX]
126 Joshua M. Murphy