LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   pppd: nameserver -> /etc/resolv.conf ?? (http://www.linuxquestions.org/questions/linux-networking-3/pppd-nameserver-etc-resolv-conf-159496/)

tredegar 03-18-2004 02:07 PM

pppd: nameserver -> /etc/resolv.conf ??
 
I have been running Mandrake 9.1 for almost a year, and love it.

I managed to set up my internet connection with an Alcatel USB ADSL modem and it has worked brilliantly most of the time. When it doesn't work it is because I am not able to do DNS lookups, and I get "Host not found". Not the modem's fault I know!

When I look at /var/log/messages I can see that pppd is telling me that my ISP has allocated me an IP address and Primary and Secondary DNS addresses, however, the DNS addresses that I am allocated change from time to time. No doubt that is why they are telling me what they are.

I can fix the problem by looking at /var/log/messages to see what DNS www.xxx.yyy.zzz I have been allocated and manually adding that to the (growing) list of nameservers in /etc/resolv.conf. But why isn't this being done automatically? It is beginning to annoy me. I know I must have something, somewhere set up wrong, but am not sure where to start looking.

Any pointers would be appreciated. Oh, and while I am taxing your brains, why is the first line in /etc/resolv.conf:

"nameserver 127.0.0.1" ? (without the quotes!)

Thanks.

Mara 03-18-2004 02:29 PM

Remove the first line. Without quotes it means that your machine is a nameserver. It probably isn't, so the like can only slow things down.

There's pppd option 'usepeerdns'. Do you have it set? It says pppd to ask peer (server) for DNSes and use them.

charon79m 03-18-2004 04:03 PM

HATE isp's like that....
 
My ISP's name servers would go down and change all the time. I got sick of it and just statically pointed my /etc/resolv to name servers I knew I could rely on. (My work's public name servers.) With a little digging you can find lots of public name servers that are up all the time and willing to resolve anything you throw at it.

I havn't had a problem since.

Cheers,

MrKnisely

tredegar 03-18-2004 04:24 PM

Mara,

Thanks, I'll take out the first line.

usepeerdns is in the file /etc/ppp/peers/adsl, is this supposed to update resolv.conf with the current nameserver(s)?

Charon79m,
Thanks for the tip and I understand, but this is annoying me and I'd like to be able to fix it.

tredegar 03-19-2004 05:43 AM

Follow-up: I think I have fixed it.

pppd has the option usepeerdns enabled. It puts the two nameservers supplied by my ISP into the file /etc/ppp/resolv.conf, but doesn't update /etc/resolv.conf

So I did the following:
su root
# cd /etc
# rm resolv.conf
# ln -s /etc/ppp/resolv.conf

This seems to have fixed it.
Thanks for the pointer Mara.

Mara 03-20-2004 10:10 AM

Nice that you have it working. :)

tredegar 03-21-2004 07:45 AM

Thanks Mara, but my fix (making that link) didn't survive a reboot: Mandrake 9.1 overwrote my link to /etc/ppp/resolv.conf with a new /etc/resolv.conf that started with the line
nameserver 127.0.0.1
and then added two (wrong) nameservers.

Much googling later I found this thread http://www.ussg.iu.edu/hypermail/lin...02.1/0146.html

Which says to edit two files in /etc/ppp called ip-up.local and ip-down.local
I did not have these files, so I created them ( and, incidentally chmod 755 them! )

FYI the files are:

if-up.local

#!/bin/bash
# copied from http://www.ussg.iu.edu/hypermail/lin...02.1/0146.html
if [ -n "$USEPEERDNS" -a -f /etc/ppp/resolv.conf ]; then
rm -f /etc/ppp/resolv.prev
if [ -f /etc/resolv.conf ]; then
cp /etc/resolv.conf /etc/ppp/resolv.prev
grep search /etc/ppp/resolv.prev > /etc/resolv.conf
grep nameserver /etc/ppp/resolv.prev >> /etc/resolv.conf
cat /etc/ppp/resolv.conf >> /etc/resolv.conf
else
cp /etc/ppp/resolv.conf /etc
fi
chmod 644 /etc/resolv.conf
fi


if-down.local

#!/bin/bash
# copied from http://www.ussg.iu.edu/hypermail/lin...02.1/0146.html
if [ -n "$USEPEERDNS" -a -f /etc/ppp/resolv.conf ]; then
if [ -f /etc/ppp/resolv.prev ]; then
cp -f /etc/ppp/resolv.prev /etc/resolv.conf
else
rm -f /etc/resolv.conf
fi
chmod 644 /etc/resolv.conf
fi


The correct entries for nameservers are now put in /etc/resolv.conf and I no longer have the (unnecessary) nameserver 127.0.0.1 as the first entry.
I hope this is the end of this thread!


All times are GMT -5. The time now is 11:24 PM.