Jan 08, 2012 CentOS 6.2 Yum Repositories Chroot MySQL PHPMyAdmin PHP Linux Command DNS SELinux VMware Windows Android VPS Internet Zimbra Collaboration Suite VMware vSphere Webmin Subversion CentOS 6 CentOS 5.5 How To Email Server Zimbra Ubuntu Wordpress nginx CentOS 6.5 CentOS 5.8 CentOS 6.3 RHEL 6 CentOS Security Fedora 16 RHEL CentOS 6.4 CentOS 7.0 Linux. CentOS DNS malfunctioning - Cannot resolve any hostnames after reboot. Ask Question 3. 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.
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
So I rebooted my server:
Now it is up and running again, but it cannot resolve any hostnames:
When I do:
I get the following error:
Even if I do:
it does not work, same error: cannot resolve hostname.
What is wrong with my server DNS?
Thanks
DextrousDaveDextrousDave1 Answer
I got this to work by making a change (adding DNS servers) to the following file:
/etc/sysconfig/network-scripts/ifcfg-eth0
As suggested by this file:
/etc/resolv.conf
DextrousDaveDextrousDaveNot the answer you're looking for? Browse other questions tagged dnscentos or ask your own question.
I'm having some DNS issues on a new box I'm installing with CentOS 6.2.
I am able to look up names using nslookup, dig, or host. I am able to ping machines by name or by IP address. However, when I try other tools, such as ssh, wget, or yum, they are unable to resolve names. For example:
My /etc/nsswitch.conf file is the default, including this (standard) line:
/etc/resolv.conf is as set up by DHCP:
192.168.1.254 is a working DNS server (my DSL modem, working for years with other machines)
Anyone know why ping would work, but ssh/wget would fail?
Per NcA's suggestion, I tried changing /etc/resolv.conf to point to 8.8.8.8. Oddly enough, this does make it work. Obviously, my DSL modem is responding to DNS requests in some way that some parts of Linux's resolution system don't like. Looking at the tcpdump, I am unable to see what the difference is. Certainly, both servers are sending the same addresses.
Here's the output from tcpdump -nn -X
with the server set to the DNS server on the DSL modem. It's clearly replying with the correct addresses, but ssh/wget don't seem happy with it for some reason:
I'm not enough of an expert to know if this is malformed in some way, but ping seems to do the right thing with it.
For comparison, here's the same thing when querying 8.8.8.8:
I still don't know why the server's reply is adequate for ping but not for ssh/wget.
If anyone has ideas, I'd be happy to hear them. For now, though, I can either refer to an outside DNS server or set up my own server on the new box. It's a workaround that seems like it should be unnecessary, but will allow me to proceed.
6 Answers
Using this: https://www.centos.org/modules/newbb/viewtopic.php?topic_id=39343
I found a key command that helped me troubleshoot:
[root@localhost ~]# wget -6 URL
-Failed
[root@localhost ~]# wget -4 URL
-Worked
It's something to do with the default ipv6 stack that's causing problems with certain utils. Disable ipv6 to resolve.
Mark Henderson♦I have the same problem but I fixed it.
You must add DNS in interface configuration file, /etc/sysconfig/network-scripts/ifcfg-eth0
. Add the line
And then you must restart network service.
Jenny DStop the firewall first. Always get that out of the way when troubleshooting network issues (whenever possible). If you drop the firewall and your issue goes away, problem solved, if not, at least it's out of the way for now.
1) iptables -L see if there are any DROP rules that could be affecting outgoing packets
2) Check to see if selinux is running and doing anything odd (/etc/selinux/config)
3) what is the output of the following: route -n
4) what does /etc/sysconfig/network-scripts/ifcfg-eth0 look like
5) can you ping your gateway without issue?
Hopefully one of these will provide the bit of information you need to diagnose the issue.
Based on the original post I added 8.8.8.8 to /etc/resolv.conf
and /etc/sysconfig/network-scripts/ifcfg-eth0
Neither edit solved my problem.
I then edited /etc/nsswitch.conf
:
Original
Edited
Now DNS works for yum and wget.
slmTry to add line 'options single-request' to your /etc/resolv.conf. This will tell libc to make 2 requests (A and AAAA) instead of sending them from the same port. It should help.