Solved

Can't get /etc/resolv.conf to configure after reboot

Posted on 2016-10-13
8
41 Views
Last Modified: 2016-11-15
This is a redhat Linux server 6.3.
when I reboot the resolv.conf file has no dns servers listed.

I have a number of VLANs attached to a single interface.  they are set up as ifcfg-eth0:1 through 6
According to the docs I've read the interface config should look something like this:
DEVICE="eth0"
BOOTPROTO="static"
NM_CONTROLLED="no"
ONBOOT=yes
TYPE="Ethernet"
UUID="81eaafdb-2746-4566-a556-06c2c2ada461"
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=AC:16:2D:74:05:D4
PEERDNS=yes
RESOLV_MODS=no
PEERROUTES=no
IPADDR=xx.26.154.35
GATEWAY=xx.26.154.33
NETMASK=255.255.255.224
DNS1=206.191.0.140
DNS2=206.191.0.210
DOMAIN=xxxnet.ca

It states that in order for resolv.conf to be set up your have to have PEERDNS set to yes and DNS1 and DNS2 set up in the config file.
which I have done.

In the VLAN files I have tried setting PEERDNS to no for all of them and then to yes for all of them. But it still doesn't set up resolv.conf properly.

If looked at the ifup_post script and it looks like it should have done something but I haven't tried debugging them.  I'm working remotely so if I mess up the network scripts, I might not be able to get on.

in the resolv.conf part of the ifup_post script it creates a backup copy of the resolv.conf file.  That backup copy does exist in /etc so that leads me to suspect it's running through the right part of the script.  The really weird thing is, the backup copy has two lines in it for name servers that are not the ones that I use.  They come from an alternate datacenter that we use for other applications.
I've grepped all the files in /etc to see if the ip address exists in any of the files, but nothing showed up.

Not sure what to do next.
0
Comment
Question by:geekdad1
  • 3
  • 3
8 Comments
 
LVL 61

Expert Comment

by:gheist
ID: 41841504
Option 1 You can disable PEERDNS and use reolv.conf with 2 DNS servers
Option 2 you can add or replace DHCP DNS servers via dhclient.conf or equivalent

You must upgrade your system, with most expensive support option it is 2 years overdue:
In Red Hat Enterprise Linux 6, EUS is available for the following minor releases:
6.3 (ends June 30, 2014)
Alternatively you can upgrade to CentOS or Oracle linux for free.
0
 
LVL 1

Author Comment

by:geekdad1
ID: 41842857
Setting PEERDNS to no on all interfaces doesn't make any difference.
DHCP is not an option . This host has a static IP address.

We are aware of the age of the server and are looking at our options.  Free is not always the best consideration.
0
 
LVL 61

Accepted Solution

by:
gheist earned 500 total points
ID: 41843128
Just remove DNS settings from /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-eth0 and customize resolv.conf to your liking (I think DNS in first file overrides 2nd)
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 

Expert Comment

by:amishra1
ID: 41845589
You can enter your desired dns in /etc/resolvconf/resolv.conf.d/head file. This will make sure when server is rebooted, DNS entries from head file are applied in /etc/resolve.conf

Let me know if that helps.
0
 
LVL 1

Author Comment

by:geekdad1
ID: 41864623
No such animal on my system.  However I think since we have virtual ip's running that PEERDNS flag needs to be set to no for all of them except the very first (non virtual) device.  I can't reboot the server just now but I will post again once I get a chance to.
0
 
LVL 61

Expert Comment

by:gheist
ID: 41864671
If you want fixed named.conf just make sure NetworkManager does not overwrite it?
resolvconf is debian stuff, you can skip that part ;)
0
 
LVL 1

Author Closing Comment

by:geekdad1
ID: 41888544
Takes a long time to test these things since I can't take the server down except for exceptional circumstances.  Will be moving to a new server soon, so this problem should resolv itself.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now