You are not logged in.

#1 2010-03-05 16:16:07

rangalo
Member
Registered: 2008-06-25
Posts: 108
Website

Cannot resolve hostname [solved]

Hi,

I cannot ping my hostname, no ip is resolved.

[hardik@moonlight: ~ ]$ ping moonlight
ping: unknown host moonlight
[hardik@moonlight: ~ ]$ hostname
moonlight

I have following entry in my /etc/hosts

[hardik@moonlight: ~ ]$ cat /etc/hosts
#
# /etc/hosts: static lookup table for host names
#

#<ip-address>    <hostname.domain.org>    <hostname>
127.0.0.1        localhost.localdomain    localhost moonlight

# End of file

Last edited by rangalo (2010-03-06 19:34:00)

Offline

#2 2010-03-05 17:31:19

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: Cannot resolve hostname [solved]

whats in resolv.conf?

Offline

#3 2010-03-05 18:05:47

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: Cannot resolve hostname [solved]

and your rc.conf.

Offline

#4 2010-03-05 18:06:48

rangalo
Member
Registered: 2008-06-25
Posts: 108
Website

Re: Cannot resolve hostname [solved]

Here is the resolve.conf.

The ip is of my AVM fritzfon  router.  But shouldn't /etc/hosts have higher priority?



[hardik@moonlight: ~ ]$ cat /etc/resolv.conf
# Generated by dhcpcd from eth0
# /etc/resolv.conf.head can replace this line
nameserver 192.168.178.1
# /etc/resolv.conf.tail can replace this line
[hardik@moonlight: ~ ]$ nslookup moonlight
Server:        192.168.178.1
Address:    192.168.178.1#53

** server can't find moonlight: NXDOMAIN

EDIT:

Here the link to rc.conf
http://pastebin.com/4v5Tj6F9

Last edited by rangalo (2010-03-05 18:08:11)

Offline

#5 2010-03-05 18:09:35

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: Cannot resolve hostname [solved]

what is the host name in rc.conf?

Offline

#6 2010-03-05 18:18:36

rangalo
Member
Registered: 2008-06-25
Posts: 108
Website

Re: Cannot resolve hostname [solved]

@kgas: It is "moonlight" see the link above.

I am sure, this was working before. I cannot tell which upgrade broke it though.

Offline

#7 2010-03-05 18:40:13

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: Cannot resolve hostname [solved]

I did not see the previous post while typing (4 mins late). Could you able to ping your assigned IP?  If you are using dual boot check any port got blocked if you use a firewall.

Offline

#8 2010-03-05 18:45:25

rangalo
Member
Registered: 2008-06-25
Posts: 108
Website

Re: Cannot resolve hostname [solved]

Yes, I can ping the assigned ip.

Offline

#9 2010-03-05 18:59:57

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: Cannot resolve hostname [solved]

is your loop back is up?(ifconfig -a).

Offline

#10 2010-03-05 19:03:10

rangalo
Member
Registered: 2008-06-25
Posts: 108
Website

Re: Cannot resolve hostname [solved]

Yes,

[hardik@moonlight: docs ]$ ifconfig  -a
eth0      Link encap:Ethernet  HWaddr 00:16:6F:00:17:34  
          inet addr:192.168.178.26  Bcast:192.168.178.255  Mask:255.255.255.0
          inet6 addr: fe80::216:6fff:fe00:1734/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:158184 errors:2 dropped:2 overruns:0 frame:0
          TX packets:112981 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:217372073 (207.3 Mb)  TX bytes:10787381 (10.2 Mb)
          Interrupt:17 Base address:0xc000 Memory:dfcfd000-dfcfdfff 

eth1      Link encap:Ethernet  HWaddr 00:14:22:EB:15:A7  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:18 

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:16436  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:940 (940.0 b)  TX bytes:940 (940.0 b)

Offline

#11 2010-03-05 22:43:42

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: Cannot resolve hostname [solved]

what does this give u?

daf666@pazuzu ~
$ host pazuzu
pazuzu has address 127.0.0.1

Offline

#12 2010-03-05 23:01:49

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: Cannot resolve hostname [solved]

What's your /etc/hosts?  You have to specify your hostname there too, i.e.

#
# /etc/hosts: static lookup table for host names
#

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost moonlight

Offline

#13 2010-03-06 07:13:22

rangalo
Member
Registered: 2008-06-25
Posts: 108
Website

Re: Cannot resolve hostname [solved]

Here the output of host command

[hardik@moonlight: ~ ]$ host moonlight
Host moonlight not found: 3(NXDOMAIN)

Offline

#14 2010-03-06 09:20:25

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: Cannot resolve hostname [solved]

OK.. so the  host name is sent to the DNS (what U got in resolv.conf) instead of being resolved locally, for reasons unknown.
Verify it like this:

# tcpdump -nni eth0 port 53 &
# ping moonlight

show output and we will work from there.

In addition, add this to /etc/hosts:

192.168.178.26           doom

then ping it by name

Offline

#15 2010-03-06 12:26:08

rangalo
Member
Registered: 2008-06-25
Posts: 108
Website

Re: Cannot resolve hostname [solved]

Here the output from tcpdump while pinging moonlight


[hardik@moonlight: ~ ]$ tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
13:23:09.850470 IP 192.168.178.26.45929 > 192.168.178.1.53: 41817+ A? moonlight. (27)
13:23:09.906559 IP 192.168.178.1.53 > 192.168.178.26.45929: 41817 NXDomain 0/1/0 (102

Here pinging doom after adding the entry in /etc/hosts

[hardik@moonlight: ~ ]$ ping doom
ping: unknown host doom
13:25:24.777568 IP 192.168.178.26.42017 > 192.168.178.1.53: 55338+ A? doom. (22)
13:25:24.832493 IP 192.168.178.1.53 > 192.168.178.26.42017: 55338 NXDomain 0/1/0 (97)

Looks like entries in /etc/hosts have no effect !

Last edited by rangalo (2010-03-06 12:29:38)

Offline

#16 2010-03-06 19:32:25

rangalo
Member
Registered: 2008-06-25
Posts: 108
Website

Re: Cannot resolve hostname [solved]

Found the reason and also the solution.

The keyword is /etc/nsswitch.conf file.

On my system, this file was corrupted. Lately I had many files corrupted due to some unknown reason. 

I moved the file to a backup one and reinstalled filesystem package, which fixed the issue.

Is there any way to know which files are corrupted ?

regards,
Hardik

Offline

Board footer

Powered by FluxBB