LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-28-2004, 12:44 PM   #1
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 550

Rep: Reputation: 32
/etc/resolv.conf keeps resetting itself


Hi I am running Linux Mandrake 9.2 on a IBM NetVista.

Everyday on my computer the Internet is either very slow or it doesn't work at all.

I have to su as root, and change /etc/resolv.conf to our corporate DNS servers. The default file is

nameserver 127.0.0.1
nameserver 198.XXX.XXX.XXX

(I can't remember off the top of my head what the XXX's are)

So I change, save, and then my Internet works perfectly, but only for a few hours. I su as root, go back into /etc/resolv.conf and find that it has the defaults again!!! grrr

I have to change the file two times a day. Is there any way to make the changes permanent??

Thank you.
 
Old 07-28-2004, 12:49 PM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 243Reputation: 243Reputation: 243
try :

chattr i /etc/resolv.conf

from man chattr :
A file with the `i' attribute cannot be modified: it cannot be deleted or renamed,
no link can be created to this file and no data can be written to the file. Only
the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or
clear this attribute.

This may help waiting to find a more mandraky way
 
Old 07-28-2004, 02:18 PM   #3
Nichole_knc
Member
 
Registered: Mar 2004
Location: Georgia
Distribution: SlackWare 10.1+, FreeBSD 4.4-5.2, Amiga 1.3,2.1,3.1, Windors XP Pro (makes a fair answering machine)
Posts: 287

Rep: Reputation: 30
Your machine is most likely getting its IP addy via DHCP. When the IP lease expires and the machine request a "new" lease the reslov.conf is re-written each time. If the client is not asking for the DNS server addys or the DHCP server is failing to provide them then this is where your problem lies...

I assume you can SU up and "man dhclient.conf" to hook up a fix on the client side...
 
Old 07-28-2004, 10:41 PM   #4
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 50
Avatar, as you are using Mandrake,

edit your /etc/sysconfig/network-scripts/ifcfg-ethx (where x is the number for the NIC that faces the Internet)
set PEERDNS=no
 
Old 07-29-2004, 08:33 AM   #5
voidmain
LQ Newbie
 
Registered: May 2004
Location: Turkey
Distribution: Slackware Linux 10.0
Posts: 6

Rep: Reputation: 0
You can also try using dhcpcd with -R switch, which causes the resolv.conf file gets never updated.
 
Old 07-30-2004, 11:36 AM   #6
Avatar
Member
 
Registered: May 2001
Location: Canada
Distribution: old ones
Posts: 550

Original Poster
Rep: Reputation: 32
Yes my computer is a DHCP client. it's IP address is normally the same, though. It is possible that it's not getting the DNS servers from the DHCP server. I have edited the ifcfg-eth0 file as ppuru suggested.

Nichole, I found this file: /usr/share/doc/dhcp-client-3.0/dhclient.conf
Should I edit it? Being that it's in a doc directory, I'm not too sure if it's acutally being used.

Thanks everyone. Hopefully this will fix it.
 
Old 07-30-2004, 06:28 PM   #7
Nichole_knc
Member
 
Registered: Mar 2004
Location: Georgia
Distribution: SlackWare 10.1+, FreeBSD 4.4-5.2, Amiga 1.3,2.1,3.1, Windors XP Pro (makes a fair answering machine)
Posts: 287

Rep: Reputation: 30
That may be a "default" conf file... I am not familiar with the mandrake /etc layout. On Slack there is a directory for dhcp in /etc and the dhcp configfiles are located in the /etc. I would assume that other distro are more or/less the same.
During a brief fling with a full dhcp server run I did read it was possible to do several things via the dhclient.conf.
You could request the same address from the server all the time. You could also set or request extended lease times. You could "fix" the DNS order and the resolv.conf write. Also set info that the dhcp server failed to pass.

I use fix addressing on my net for my prime machines. My Dragon pups get their addys via netboot and dhcp only these addresses and the server assigns addies to the mac of the nic directly.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Who changes /etc/resolv.conf? lmp Debian 4 11-29-2005 08:08 AM
resolv.conf stanleytiew Linux - Newbie 2 05-13-2005 04:25 PM
/etc/resolv.conf keeps resetting kubicon Linux - Networking 2 02-05-2004 02:37 PM
resolv.conf Culbert Linux - Networking 8 03-20-2003 04:11 PM
Resolv.conf tristan_vdv Linux - Networking 2 11-20-2001 06:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration