Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The people over on the rPi forums don't have any answers for me...

I've got a raspberry pi running raspbian server edition. My problem is that the only way I can ssh into it with putty is through the static ip.

My router doesn't recognize the hostname; it shows the mac address as the name. This causes the pi not to show my apache2 website online (I think). The only way I've gotten it to work is using my other linux server to forward using virtual hosts, and that has to use the ip address, too.

However, now that I have my other server off, the website doesn't work.

share|improve this question
Do you have a DNS server set up? – mikołak Jul 2 '13 at 21:19
Uh, I'm not sure... How would I know? – xSpartanCx Jul 2 '13 at 21:30
You probably don't then :). Writing up the answer. – mikołak Jul 2 '13 at 21:30
In /etc/resolv.conf i have "nameserver" if that helps any – xSpartanCx Jul 2 '13 at 21:40
up vote 1 down vote accepted

The hostname for your server is for the purpose of IP resolution local to your Pi. The router won't recognize it automatically.

The network protocol which is used for network communication does not use domain/host names, just MAC addresses - the former are mostly for the convenience of us humans.

Unless you have a router that actively queries hostnames from the machines set up on your LAN (haven't seen such a thing myself), your router recognizes devices by their MACs.

Your best bet is to simply:

  1. Set up a static IP for your Pi's MAC (if you haven't already).
  2. Set up the virtual host port forwarding to your Pi directly on your router (most should handle that, so that you don't need to use your other machine for this purpose).

You could set up a DNS server on your Pi, such as bind9, which would map your hostname to your IP address, but that requires a lot of configuration, and would only work on the computers that recognize that DNS server anyway (so computers/servers that you have specifically set up for this).

If you want to refer to your Pi using it's hostname from your desktop/laptop, add the hostname/IP number pair to your computer's hosts file.

share|improve this answer
The reason I had the other server was so I could run two websites. This is what my /etc/apache2/httpd.conf file looks like on the other – xSpartanCx Jul 2 '13 at 21:48
Also, my other server "piston"'s hostname showed up on the router, and it worked with putty – xSpartanCx Jul 2 '13 at 21:53
Your router queried your Pi for the hostname, that's why it showed up on the list. And Putty recognizing it is just its feature apparently, the ssh client I have installed on my Linux box does no such thing. I would say that your best bet is to stick with your current Apache config, optionally adding the hostname/IP pair to your "main" server's /etc/hosts file, so that you can use your Pi's hostname in httpd.conf. – mikołak Jul 2 '13 at 22:02
and this is my /etc/network/interfaces: – xSpartanCx Jul 2 '13 at 22:04
But the problem is, now that I turned off my other server, nothing works on the Pi – xSpartanCx Jul 2 '13 at 22:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .