Share this question

Welcome to Teachnovice Q&A, where you can ask questions and receive answers from other members of the community.

This is a collaboratively edited question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

CentOS Cannot resolve any hostnames?

0 like 0 dislike
58 views

I am trying to set up a server(PHP/HTTPD) in CentOS. When I use ipaddress to access the website its working fine. But using domain name its not working. So I used ping command to check.

ping 246.246.44.66 // Working fine 
ping example.com // ping: unknown host example.com

Here is /etc/sysconfig/network-scripts/ifcfg-eth0:

DEVICE="eth0"
TYPE="Ethernet"
IPV6INIT="no"
MTU="1500"
NM_CONTROLLED="yes"

ONBOOT="yes"
BOOTPROTO="static"
IPADDR="246.246.44.66"
NETMASK="255.255.255.0"
GATEWAY="246.246.44.71"

/etc/sysconfig/network:

NETWORKING=yes
HOSTNAME=example.com

/etc/hosts:

246.246.44.66 example.com
127.0.0.1   localhost

/etc/resolv.conf:

domain example.com
nameserver 8.8.8.8
nameserver 246.246.44.65
nameserver 246.246.44.64

while using route command

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
246.246.44.0    *               255.255.255.0   U     0      0        0 eth0
link-local      *               255.255.0.0     U     1002   0        0 eth0
link-local      *               255.255.0.0     U     1003   0        0 eth1
default         246.246.44.1    0.0.0.0         UG    0      0        0 eth0

Please help me. Also correct me if I am wrong because I am programmer not a server admin

asked Feb 5, 2015 by Cakephp.Saint  

2 Answers

0 like 0 dislike
 
Best answer
We found out it was a DNS problem

first we added the and domainname.com to the /etc/hosts file of the workstation. This resolved the issue. So we concluded it was a DNS issue.

after that we queried his DNS servers with 'dig @' which gave no results. Without the proper dns records the workstation will never find the correct hosts.
answered Feb 5, 2015 by Koen van der Rijt  
0 like 0 dislike
Your network configuration is hardly the issue here. Is the domain you are testing registered? The first DNS in your list the is the Google public DNS. It won't come up with valid addresses for fictious test domains.

Make sure that only your internal DNS servers are in resolv.conf, and make sure that there are valid records in it for the domain you are testing with.
answered Feb 5, 2015 by Håvid Falch  
...