LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 05-18-2012, 12:50 AM   #1
dushyantgohil
Member
 
Registered: Aug 2011
Location: India
Distribution: Cent OS & Ubuntu
Posts: 106

Rep: Reputation: 3
Having issue in resolv.conf


hi,

i am using lamp server on Cent os 5.5, but there is issue with my resolv.conf file. after every reboot or restart of network service i need to edit the nameserver details. how can i make resolv.conf file permanent after editing.

 
Old 05-18-2012, 01:01 AM   #2
fogpipe
Member
 
Registered: Mar 2011
Distribution: Slackware 64 Current
Posts: 327

Rep: Reputation: 77
Quote:
Originally Posted by dushyantgohil View Post
hi,

i am using lamp server on Cent os 5.5, but there is issue with my resolv.conf file. after every reboot or restart of network service i need to edit the nameserver details. how can i make resolv.conf file permanent after editing.

I have a caching nameserver set up and the instructions in the resolv.conf originally read such that creating a resolv.conf.head file with the ip of your preferred nameserver would supersede the resolv.conf file.

it seems to have worked for me, more info here:
https://wiki.archlinux.org/index.php/Resolv.conf
 
Old 05-18-2012, 01:41 AM   #3
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Check in /etc/sysconfig/ or the config for dhclient for a setting on whether dhclient updates /etc/resolv.conf. Also Better yet, don't use dhclient on a server. All servers should have static addresses.

You can also change the attribute of the file to prevent modifying. Before resorting to this, check the boot logs for messages about modifying resolv.conf.

Last edited by jschiwal; 05-18-2012 at 01:46 AM.
 
Old 05-18-2012, 02:01 AM   #4
nikmit
Member
 
Registered: May 2011
Location: Nottingham, UK
Distribution: Debian
Posts: 178

Rep: Reputation: 34
A quick-and-dirty way of doing it, when all else fails:
chattr +i /etc/resolv.conf

This can be reverted with chattr -i quite predictably
 
Old 05-21-2012, 01:12 AM   #5
dushyantgohil
Member
 
Registered: Aug 2011
Location: India
Distribution: Cent OS & Ubuntu
Posts: 106

Original Poster
Rep: Reputation: 3
i have used "chattr +i /etc/resolv.conf" but it is not working in my case. is any thing else which can sort out my issue?
 
Old 05-21-2012, 08:20 AM   #6
jamrock
Member
 
Registered: Jan 2003
Location: Kingston, Jamaica
Posts: 444

Rep: Reputation: 41
Quote:
Check in /etc/sysconfig/ or the config for dhclient for a setting on whether dhclient updates /etc/resolv.conf. Also Better yet, don't use dhclient on a server. All servers should have static addresses.

You can also change the attribute of the file to prevent modifying. Before resorting to this, check the boot logs for messages about modifying resolv.conf.

It seems as if you are using dhcp. The dhcp server appears to be resetting your resolv.conf file each time you restart. Try setting a fixed i.p. address for the network card.
 
Old 05-22-2012, 05:16 AM   #7
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
The chattr problem may be due to the mount options used for the filesystem. Try adding the user_xattr option.

I second the idea of setting your network options; IP address, netmask, default gateway settings. One should be able to depend on a server's IP address. Then don't start the dhcp client service, or even uninstall it.
 
Old 10-18-2012, 01:42 AM   #8
dushyantgohil
Member
 
Registered: Aug 2011
Location: India
Distribution: Cent OS & Ubuntu
Posts: 106

Original Poster
Rep: Reputation: 3
Unhappy

i have configured fixed ip for my server but there is no change in my issue.
 
Old 10-18-2012, 04:18 AM   #9
DutchGeek
Member
 
Registered: Sep 2006
Distribution: SuSE, Slackware
Posts: 51

Rep: Reputation: 4
I am not sure if this is available on CentOS, but in slackware there is /etc/resolv.conf.head.
whatever you put there will be added on top to the overwritten /etc/resolv.conf

Ofcourse changing permissions or trying this is not the perfect solution.
 
Old 10-18-2012, 04:28 AM   #10
dushyantgohil
Member
 
Registered: Aug 2011
Location: India
Distribution: Cent OS & Ubuntu
Posts: 106

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by DutchGeek View Post
I am not sure if this is available on CentOS, but in slackware there is /etc/resolv.conf.head.
whatever you put there will be added on top to the overwritten /etc/resolv.conf

Ofcourse changing permissions or trying this is not the perfect solution.
there is nothing like /etc/resolv.conf.head in cent os.
 
Old 10-26-2012, 12:28 AM   #11
dushyantgohil
Member
 
Registered: Aug 2011
Location: India
Distribution: Cent OS & Ubuntu
Posts: 106

Original Poster
Rep: Reputation: 3
not working yet, some one tell me is there any other way to resolve this problem.
 
Old 11-07-2012, 03:34 AM   #12
dushyantgohil
Member
 
Registered: Aug 2011
Location: India
Distribution: Cent OS & Ubuntu
Posts: 106

Original Poster
Rep: Reputation: 3
no one can help me out in this?????


 
Old 11-07-2012, 03:58 AM   #13
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,884

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Doh, since the chattr trick doesn't work, you can put in /etc/rc.local the following
Code:
echo "nameserver x.x.x.x" > /etc/resolv.conf
Or create a resolv.conf to your liking (e.g in your home dir) and use in the above said file:
Code:
cat /home/user/resolv.conf > /etc/resolv.conf
Not the best solutions, but since everything else fails..
 
Old 11-07-2012, 04:55 AM   #14
dushyantgohil
Member
 
Registered: Aug 2011
Location: India
Distribution: Cent OS & Ubuntu
Posts: 106

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by bathory View Post
Doh, since the chattr trick doesn't work, you can put in /etc/rc.local the following
Code:
echo "nameserver x.x.x.x" > /etc/resolv.conf
using this one already want some proper solutions
 
Old 11-07-2012, 08:31 AM   #15
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,884

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Quote:
using this one already want some proper solutions
I thought you want just to do your job as every solution failed
Anyway, have you looked at this approach

Regards
 
  


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
Issue with resolv.conf : Multiple DNS with two NIC's lank23 Linux - Networking 4 01-30-2007 09:38 PM
Fedora DNS resolv.conf issue waelaltaqi Linux - Networking 16 07-05-2006 03:23 AM
DNS Hosts.conf or resolv.conf problem mac_casey Suse/Novell 0 03-26-2006 09:21 AM
Route and Resolv.conf Issue FrodoNeil Linux - Networking 2 12-07-2004 11:55 PM
resolv.conf jmdlcar Slackware 9 05-15-2004 11:44 AM


All times are GMT -5. The time now is 02:21 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration