LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-28-2013, 11:29 AM   #1
rpmacaspac
Member
 
Registered: Jul 2013
Distribution: centos 6
Posts: 48

Rep: Reputation: Disabled
/etc/resolv.conf rewritting when service network restart


i was configuring bind. and whenever i restart network, /etc/resolv.conf change the value of nameserver. my eth0 is configured as dhcp and it gives an ipaddress of 10.0.2.15 then I set the content of /etc/resolv.conf nameserver to 10.0.2.15. problem is it rewrites after i restart network service. also, when i restart named.(service named restart) theres an error zone apc.com/IN: has no ns record
 
Old 08-28-2013, 09:48 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Jessie, Linux Mint 17
Posts: 7,751

Rep: Reputation: 272Reputation: 272Reputation: 272
DHCP is the program which automagically configures your internet connection every time you start or restart your nework. So when you configure /etc/resolv.conf then DHCP is overwriting what you entered the next time DHCP runs. You can modify how DHCP configures resolv.conf by modifying /lib/dhcpcd/dhcpcd-hooks.

You can learn how to modify what DHCP sets up by beginning at this web page:

http://www.linuxfromscratch.org/blfs...et/dhcpcd.html

---------------------------
Steve Stites
 
Old 08-28-2013, 10:01 PM   #3
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 664

Rep: Reputation: 80
well there is another solution too but i would not advise that untill you are sure that resolv.conf should not change further and if yes you have to make the changes manually every time.

For that all you have to do is make required changes in resolv.conf file, save and exit -->
Code:
chattr +i /etc/resolv.conf 
service network restart    # this time it will not change
 
Old 08-29-2013, 12:31 AM   #4
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
if you run a local named, you should set nameserver to 127.0.0.1 in resolv.conf, not to the IP address of eth0.

on redhat-type distros, you would add 'PEERDNS=no' to /etc/sysconfig/network-scripts/ifcfg-eth0, to prevent
the dhcp client from changing resolv.conf.
 
1 members found this post helpful.
Old 08-29-2013, 09:32 PM   #5
rpmacaspac
Member
 
Registered: Jul 2013
Distribution: centos 6
Posts: 48

Original Poster
Rep: Reputation: Disabled
so the value of my /etc/resolv.conf would be nameserver=10.0.2.15 and nameserver 127.0.0.1?
 
Old 08-29-2013, 09:56 PM   #6
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
it should look like this.
Code:
nameserver 127.0.0.1
 
Old 08-29-2013, 10:53 PM   #7
rpmacaspac
Member
 
Registered: Jul 2013
Distribution: centos 6
Posts: 48

Original Poster
Rep: Reputation: Disabled
how about if i want to run in locally in small lan, would they see that
 
Old 08-29-2013, 11:15 PM   #8
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 664

Rep: Reputation: 80
Quote:
Originally Posted by rpmacaspac View Post
how about if i want to run in locally in small lan, would they see that
No matter what but AFA DHCP is concerned it will do its work. If you are asking about seeing the ip you provided in nameserver then the answer is NO. 127.0.0.1 is bound to localhost other LAN wont see it.

Last edited by SAbhi; 08-29-2013 at 11:16 PM.
 
Old 08-29-2013, 11:39 PM   #9
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
the other machines on the lan should use 'nameserver 10.0.2.15' in their resolv.conf, or whatever IP address the server running bind has on the lan. that server should have a static IP address, then, but if you insist on its being provisioned by a dhcp server, you'll have to make sure the dhcp server gives it the same address every time.
 
  


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
what is the difference between service network reload and service network restart ? markraem Linux - Networking 3 11-21-2007 04:08 PM
what is the use of network-script, resolv.conf, network nawuza Linux - Software 3 01-06-2007 09:23 AM
How do I set the regulatory daemon to restart when I restart the network service? zahadumy Linux - Networking 0 11-05-2006 12:24 PM
at restart resolv.conf it is like it has to be??? meDream Linux - Networking 10 05-27-2005 03:16 AM
resolv.conf changing everytime network restart cuco76 Linux - Networking 4 11-29-2004 09:19 PM


All times are GMT -5. The time now is 11:02 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