Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running Linux VPS on CentOS 6.4, and I log into it remotely via putty

I made a change to my /etc/sysconfig/selinux file:

/etc/sysconfig/selinux

# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - No SELinux policy is loaded.
SELINUX=disabled  (default was 'enforcing')

So I rebooted my server:

shutdown -r now

Now it is up and running again, but it cannot resolve any hostnames:

When I do:

wget http://wordpress.org/latest.tar.gz

I get the following error:

Resolving www.wordpress.org... failed: Temporary failure in name resolution.

Even if I do:

nslookup google.com

it does not work, same error: cannot resolve hostname.

What is wrong with my server DNS?

Thanks

UPDATE: This is the output from my /etc/resolv.conf file

# 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

Also, I can ping IP addresses. So this is a DNS issue

share|improve this question
3  
1) Have you tried reverting the change you made to IP Tables? 2) Have you checked your DNS settings in /etc/resolv.conf? 3) Have you tried pinging IP addresses (and not hostnames)? –  David W Jul 8 '13 at 14:19
    
Put the DNS servers' IP addresses into either your resolv.conf file or your ifcfg-eth<n> file like the resolv.conf file is telling you to. Are you using NM_Controlled=yes on your ifcfg file? –  user160910 Jul 8 '13 at 15:20
    
Is this your first reboot since setting this server up? I am guessing it has nothing to do with disabling SELinux and you simply didn't have your DNS settings properly set. You can try making sure Network Manager is not controlling your DNS by seeing that it is set to NM_Controlled=NO in ifcfg-eth0 and then manually set the DNS and search (domain) settings in resolv.conf, then restart network services. –  user160910 Jul 8 '13 at 15:24
4  
It's also worth mentioning that the intended audience of this site is professional system administrators operating in a professional capacity. Running your own VPS is more suited to the Unix & Linux site. For more information about this site, please take the tour! –  Aaron Copley Jul 8 '13 at 18:03
2  
RHEL is extremely well documented. If you intend to manage this server yourself, you would do well to familiarize yourself with the docs as they will be very helpful. –  Michael Hampton Jul 8 '13 at 19:47
show 4 more comments

closed as off-topic by mdpc, Scott Pack, Basil, Skyhawk, Wesley Jul 8 '13 at 19:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about hardware or software used in a home setting are off-topic because they require answers that may not be practical for the business and support professionals here. You should try asking on Super User instead." – mdpc, Scott Pack, Basil, Skyhawk, Wesley
If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers

up vote 4 down vote accepted

Simply adding a resolver to /etc/resolv.conf will work to configure name resolution, but might not be persistent. This is the old way of doing things and assumes your host does not have NetworkManager running. NetworkManager will attempt to manage these files for you, and if you edit them by hand you can find them overwritten. This is likely what happened since the symptom appeared after reboot.

To use this method you will also need to make sure NetworkManager is stopped and disabled.

chkconfig NetworkManager off; service NetworkManager stop 

Or, you can do as the first lines of /etc/resolv.conf suggests and configure your name servers in /etc/sysconfig/network-scripts/ifcfg-eth0 (Usually eth0...)

DNS1=8.8.8.8
DNS2=8.8.4.4
DOMAIN=localdomain
share|improve this answer
    
thank you very much for the help Aaron. People like you make sites like these great, and others learn from it too. One question, do i need to reboot the server when making changes like this? –  DextrousDave Jul 8 '13 at 19:38
    
I did not reboot and it works. thank you. But do you think it is necessary to reboot? –  DextrousDave Jul 8 '13 at 19:47
1  
@DextrousDave You might want to reboot, just to make sure the machine can reboot properly. –  Michael Hampton Jul 8 '13 at 19:53
    
No it isn't. If it is working then you should be all set, if not only a restart of network services is necessary with service network restart. Reboots are rarely needed in Linux unless you modify the kernel version (or a number of other cases). –  user160910 Jul 8 '13 at 19:53
    
thank you Greg. Is it better to use Google DNS servers rather than a local one in your country? What are the benefits of using Google DNS instead, apart from the fact that they are TLD servers? –  DextrousDave Jul 9 '13 at 5:14
show 1 more comment

I am sure its your /etc/resolv.conf file. In your /etc/resolv.conf file add 8.8.8.8 and 8.8.4.4 these are for google DNS. So your file should have the entries listed below. After that is completed do an nslookup on www.google.com and all should be well.

nameserver 8.8.8.8

nameserver 8.8.4.4

share|improve this answer
    
Thank you for your answer, but the resolv.conf file says the following, so I don't think the DNS settings should be placed in the resolv file...# No nameservers found; try putting DNS servers into your # ifcfg files in /etc/sysconfig/network-scripts like so: –  DextrousDave Jul 9 '13 at 5:07
add comment

Based on your reslove.conf file,All content has been commented out with #. You can add this to your reslove.conf

nameserver 8.8.8.8

nameserver 8.8.4.4

and save it. You can replace the google public dns to any dns you want. try it.

share|improve this answer
    
Thank you for your answer, but the resolv.conf file says the following, so I don't think the DNS settings should be placed in the resolv file...# No nameservers found; try putting DNS servers into your # ifcfg files in /etc/sysconfig/network-scripts like so: –  DextrousDave Jul 8 '13 at 19:36
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.