Hostname cannot be resolved

Issues related to configuring your network
Post Reply
gramaphane
Posts: 2
Joined: 2015/04/03 08:59:02

Hostname cannot be resolved

Post by gramaphane » 2015/04/03 09:13:21

I have recently installed centos 6.6 on a desktop pc. when i try to run some application i get a hostname cannot be resolved error message. I tried to set hostname from command line as root and i still get the error. below is some network info.

Code: Select all

== BEGIN uname -rmi ==
2.6.32-504.12.2.el6.i686 i686 i386
== END   uname -rmi ==

== BEGIN rpm -qa \*-release\* ==
centos-release-6-6.el6.centos.12.2.i686
== END   rpm -qa \*-release\* ==

== BEGIN cat /etc/redhat-release ==
CentOS release 6.6 (Final)
== END   cat /etc/redhat-release ==

== BEGIN getenforce ==
Enforcing
== END   getenforce ==

== BEGIN ifconfig -a ==
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1048 (1.0 KiB)  TX bytes:1048 (1.0 KiB)

p2p1      Link encap:Ethernet  HWaddr 78:45:C4:11:C0:7C
          inet addr:10.0.21.187  Bcast:10.0.21.255  Mask:255.255.254.0
          inet6 addr: fe80::7a45:c4ff:fe11:c07c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1413985 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22690 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:143788003 (137.1 MiB)  TX bytes:4084463 (3.8 MiB)

== END   ifconfig -a ==

== BEGIN route -n ==
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.20.0       0.0.0.0         255.255.254.0   U     1      0        0 p2p1
0.0.0.0         10.0.21.254     0.0.0.0         UG    0      0        0 p2p1
== END   route -n ==

== BEGIN sysctl -a | grep .rp_filter ==
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.all.arp_filter = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.arp_filter = 0
net.ipv4.conf.lo.rp_filter = 1
net.ipv4.conf.lo.arp_filter = 0
net.ipv4.conf.p2p1.rp_filter = 1
net.ipv4.conf.p2p1.arp_filter = 0
== END   sysctl -a | grep .rp_filter ==

== BEGIN ip rule show ==
0:      from all lookup local
32766:  from all lookup main
32767:  from all lookup default
== END   ip rule show ==

== BEGIN ip route show ==
10.0.20.0/23 dev p2p1  proto kernel  scope link  src 10.0.21.187  metric 1
default via 10.0.21.254 dev p2p1  proto static
== END   ip route show ==

== BEGIN cat /etc/resolv.conf ==
# Generated by NetworkManager
domain ub.bw
search ub.bw
nameserver 168.xxx.x.60
nameserver 168.xxx.x.61
== END   cat /etc/resolv.conf ==

== BEGIN egrep 'net|hosts' /etc/nsswitch.conf ==
#hosts:     db files nisplus nis dns
hosts:      files dns
#networks:   nisplus [NOTFOUND=return] files
#netmasks:   nisplus [NOTFOUND=return] files
netmasks:   files
networks:   files
netgroup:   nisplus
== END   egrep 'net|hosts' /etc/nsswitch.conf ==

== BEGIN chkconfig --list | grep -Ei 'network|wpa' ==
NetworkManager  0:off   1:off   2:on    3:on    4:on    5:on    6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
wpa_supplicant  0:off   1:off   2:off   3:off   4:off   5:off   6:off
== END   chkconfig --list | grep -Ei 'network|wpa' ==

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: Hostname cannot be resolved

Post by gerald_clark » 2015/04/03 14:19:27

"some application" may need to verify hostname matches IP address.
Add your IP address and hostname to /etc/hosts.

gramaphane
Posts: 2
Joined: 2015/04/03 08:59:02

Re: Hostname cannot be resolved (partially solved)

Post by gramaphane » 2015/04/05 08:45:38

Thanks Gerald_clark.

It works after adding IP and Hostname to /etc/hosts. However my PC is on DHCP, the current IP is not reserved for my PC. How can i get a lasting solution without talking to the network administrators?
thanks.

Ramaphane

Whoever
Posts: 1361
Joined: 2013/09/06 03:12:10

Re: Hostname cannot be resolved

Post by Whoever » 2015/04/05 14:31:53

Add the hostname as an alias of localhost.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: Hostname cannot be resolved

Post by gerald_clark » 2015/04/05 15:49:01

Servers should have static IPs.
You DHCP server should update your DNS server.

Post Reply