LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 12-21-2012, 04:49 AM   #1
sudo_su
Member
 
Registered: Aug 2012
Location: Australia
Distribution: Redhat, CentOS
Posts: 59

Rep: Reputation: Disabled
DNS entry vanishes after restart


Dear experts,

I had configured my system for static IP, GATEWAY and DNS. I put gateway entry in;

"/ets/sysconfig/network.conf"

and DNS entry in;

"/etc/resolve.conf"

"ifcfg-em1" only contains my IP and subnet mask.

the problem is that my system resolves names properly but everytime it restarts, ,my nameserver entry from resolve.conf is removed and I need to re-enter my dns entry which sounds weird.
Quote:
[root@localhost ~]# vi /etc/resolv.conf
# Generated by NetworkManager


# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
~

~
~
"/etc/resolv.conf" 9L, 228C
how to overcome this issue, please.
 
Old 12-21-2012, 04:54 AM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,971

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Which dhcp client does your system use? When you use dhcpcd with a static IP, you will have to add "nohook.resolv.conf" to the /etc/dhcpcd.conf file.
When you use another dhcp client, read the manpage.

Markus
 
Old 12-21-2012, 05:00 AM   #3
sudo_su
Member
 
Registered: Aug 2012
Location: Australia
Distribution: Redhat, CentOS
Posts: 59

Original Poster
Rep: Reputation: Disabled
Brother,

how would i find that out :S

I am using CentOS.
 
Old 12-21-2012, 05:05 AM   #4
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,971

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Execute
Code:
apropos dhcp
find out if dhcpcd is installed and if it's not find out which program is used instead.
Afterwards read it's manpage.

Markus
 
Old 12-21-2012, 05:05 AM   #5
bradvan
Member
 
Registered: Mar 2009
Posts: 178

Rep: Reputation: 28
If you are using static ips, disable network manager.
 
Old 12-21-2012, 05:09 AM   #6
sudo_su
Member
 
Registered: Aug 2012
Location: Australia
Distribution: Redhat, CentOS
Posts: 59

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by markush View Post
Execute
Code:
apropos dhcp
find out if dhcpcd is installed and if it's not find out which program is used instead.
Afterwards read it's manpage.


Markus
That is what I get;
Quote:
[root@localhost ~]# apropos dhcp
dhclient-script (8) - DHCP client network configuration script
dhclient.conf [dhclient] (5) - DHCP client configuration file
dhclient.leases [dhclient] (5) - DHCP client lease database
dhcp-eval (5) - ISC DHCP conditional evaluation
dhcp-options (5) - Dynamic Host Configuration Protocol options
dhcpc_selinux (8) - Security Enhanced Linux Policy for the dhcpc processes
dhcpd_selinux (8) - Security Enhanced Linux Policy for the dhcpd processes
dnsmasq (8) - A lightweight DHCP and caching DNS server
kpac_dhcp_helper (7) - provides Proxy Auto Configuration to KDE
 
Old 12-21-2012, 05:11 AM   #7
sudo_su
Member
 
Registered: Aug 2012
Location: Australia
Distribution: Redhat, CentOS
Posts: 59

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bradvan View Post
If you are using static ips, disable network manager.
brother from where I am gona disable it?
 
Old 12-21-2012, 05:12 AM   #8
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,971

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Well it's dhclient, read the manpage for dhclient and dhclient.conf

Markus
 
Old 12-21-2012, 05:15 AM   #9
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,971

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Quote:
Originally Posted by sudo_su View Post
brother from where I am gona disable it?
Well, this depends on your distribution, I would google for "centos static ip" or "centos networkmanager" ...... and find this http://www.centos.org/docs/5/html/De...nterfaces.html

Markus
 
Old 01-04-2013, 05:41 AM   #10
bradvan
Member
 
Registered: Mar 2009
Posts: 178

Rep: Reputation: 28
Sorry, I was away for the Christmas break.

First, cd /etc/sysconfig/network-scripts then:
Code:
for f in ifcfg-eth?; do
   if [ $(grep -c 'NM_CONTROLLED="yes"' ${f}) -gt 0 ]; then
      echo "Modifying the ${f} script to disable network manager."
      sed -i 's/^\(NM_CONTROLLED="\)yes.*/\1no"/' ${f}
   fi
   if [ $(grep -c "^DNS" ${f}) -gt 0 ]; then
      echo "Deleting the dns resolver entries from ${f}."
      sed -i '/^DNS/d' ${f}
   fi
done
Make sure your /etc/resolv.conf is set up correctly. Then do:
Code:
rpm -e NetworkManager-gnome NetworkManager-glib NetworkManager
That should get rid of Network Manager.
 
Old 01-06-2013, 08:07 PM   #11
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,283

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
If you just want to disable it on a per NIC basis
Code:
cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
HWADDR="E0:CB:4E:B9:5F:1A"
NM_CONTROLLED="no"
ONBOOT="yes"
BOOTPROTO="dhcp"
 
  


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
DNS entries vanishes after login in Ubunutu 5.10 c_anindya Linux - Networking 1 02-22-2006 09:02 PM


All times are GMT -5. The time now is 12:00 PM.

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