[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: ppp not getting dns info on connect



Joe Conway wrote:

> Chuck_Sterling wrote:
>> On fc2, all updates installed, ppp connects to my local ISP and I get
>> a dynamic IP address as expected, but the default gateway and dns
>> server IP addresses are not set up. This did work correctly on fc1,
>> and does under fc2 when connecting via ethernet at $WORK.
> 
> I found that the default gateway was working fine, but usepeerdns was
> not causing a resolv.conf to be created, as the pppd man page says it
> should:
> 
>     usepeerdns
>       Ask  the  peer  for up to 2 DNS server addresses.  The addresses
>       supplied by the peer (if any) are passed to  the  /etc/ppp/ip-up
>       script in the environment variables DNS1 and DNS2, and the envi-
>       ronment variable USEPEERDNS will be set to 1.  In addition, pppd
>       will  create  an /etc/ppp/resolv.conf file containing one or two
>       nameserver lines with the address(es) supplied by the peer.
> 
> I ended up creating /etc/ppd/ip-up.local as suggested in
> /etc/ppd/ip-up. It looks like:
> 
> 8<------------------------
> #!/bin/bash
> 
> echo "created by pppd" > /etc/resolv.conf
> echo "nameserver ${DNS1}" >> /etc/resolv.conf
> echo "nameserver ${DNS2}" >> /etc/resolv.conf
> 8<------------------------
> 
> Seemed to do the trick for me.
> 
> Note that when plugged into a LAN, /etc/resolv.conf gets overwritten
> by dhclient (which is what you probably want if you're on a LAN). If
> you're using a static IP for your wired connection, you might want to
> put the ppp resolv.conf in /etc/ppp as suggested on the man page.
> However, I haven't tried that to see if it works.
> 
> HTH,
> 
> Joe
> 
> 

I set up the script. Simple enough; I wonder why it was not included in
the distribution. Anyway, I added one line to change the permissions on
the generated /etc/resolv.conf file, which is owned by root and has
tight permissions when created. I guess another method would be to
create the file with more permissive restrictions, then clear it out
each time by cp-ing /dev/null to it. I did not bother trying that since
this works without preparation.

-------------------------------

#!/bin/bash
 
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

-------------------------------

The original permissions:
-rw-------  1 root root 94 Jun 29 17:47 resolv.conf

The modified permissions:
-rw-r--r--  1 root root 94 Jun 29 17:47 resolv.conf

The content of resolv.conf...
(with ip addresses x'd out, of course, just in case):

-------------------------------

Created by pppd and /etc/ppp/ip-up.local
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx

-------------------------------

Thanks again for pointing me in the right direction...

Now to figure out how to connect to $WORK...

Chuck




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]