Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just installed raspbian on my raspberry pi, and was wondering why I can't use it's hostname from other machines.

on my router, I can see which computers are connected by their name, for example a windows pc, a mac, my iphone, etc... all have names. But for my Pi, I see only the ip adress.

on the pi, I have set hostname correctly, like this:

pi@pi ~ $ sysctl kernel.hostname
kernel.hostname = pi

hostname also delivers:

pi@pi ~ $ hostname
pi

but hostname -d won't deliver anything:

pi@pi ~ $ hostname -d 
pi@pi ~ $ 

why is this? why can't I run ping pi on any other machine and get to the pi?

thanks

share|improve this question
    
hostname -d is unreliable; RTFM. I think you need to provide more information about your router, and /etc/host*s, and /etc/resolv.confs of the hosts, for a useful answer. ping resolves names according to DNS: if the host pinged from can't resolve it, it asks the next DNS server; on WLAN routers that is usually coupled with a DHCP server. I think the DNS server can't know about the hostname if the target host doesn't tell it implicitly when requesting an IP address via a DHCP vendor extension. This question is probably too localized. –  PointedEars Feb 24 '13 at 14:02
    
Thanks @PointedEars for your comment. I have a fritz.box router. As I said, all other machines tell the DHCP server on the router their name... but the pi doesn't. resolv.conf shows the following line: nameserver 192.168.178.1 which is the router's ip. I edited hosts with the line 127.0.0.1 pi... should I put here the real ip? what if it changes? i`m using dhcp on the pi. –  otmezger Feb 24 '13 at 15:41
    
As your router is the primary DNS server for your clients, it is as I said. You need to configure your Raspian to tell the router on DHCP handshake what the client's hostname is. A change in your DHCP client configuration in /etc/dhcp* to use the vendor extension is more likely to help than the FQDN in the hosts file. With dhclient 4.x, there should be a line like send host-name = gethostname(); in your /etc/dhcp/dhclient.conf. –  PointedEars Feb 26 '13 at 20:58

1 Answer 1

Put into /etc/dhcp/dhclient.conf:

send host-name "yourhostname"

and remove "host-name" from the "request" statement.

share|improve this answer
    
I already did that... but still doesn't work :-( –  otmezger Feb 25 '13 at 8:57
    
Hmm, sorry to hear. After due restarts (of the router, too), I suppose. –  Sz. Feb 26 '13 at 19:26
    
I see no reason to remove the host-name request option; DNS resolution works fine with that option here (Debian 7.0 with dhclient 4.2.4 connected to a Linksys WRT54GL). In any event, the logfiles should tell what happened, and dhclient -v or service networking restart on the client(s) should suffice. –  PointedEars Feb 26 '13 at 21:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.