CentOS Cannot resolve any hostnames

centosdomain-name-systemreverse-dns

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

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.

Related Topic