1
0
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
hostname -d
is unreliable; RTFM. I think you need to provide more information about your router, and/etc/host*
s, and/etc/resolv.conf
s 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 – 2013-02-24T14:02:35.657Thanks @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 editedhosts
with the line127.0.0.1 pi
... should I put here the real ip? what if it changes? i`m using dhcp on the pi. – otmezger – 2013-02-24T15:41:30.303As 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 thehosts
file. With dhclient 4.x, there should be a line likesend host-name = gethostname();
in your/etc/dhcp/dhclient.conf
. – PointedEars – 2013-02-26T20:58:15.623