0

I have an ubuntu server (as a NAS) at home. I use an always-on Raspberry Pi to turn the server on when I need it (WakeOnLan). Both the server and the Pi are accessible via the local network.

My router is configured for port forwarding of both the Pi port and the server ports.

My problem: I can access the Pi remotely, but for some reason not the server itself. I can first ssh to the Pi and from there to the server, though. Even when I copied the /etc/ssh/sshd_config from my Pi to the server, I still couldn't access it remotely. What could be the issue here?

  • Which are the exact commands you are using? Didn't you forward the ssh port (e.g. port 22) to the raspberry pi? Which ports do you forward to the pi and which to the server? – Gasp0de Mar 16 '16 at 15:33
  • I forward port 223 to the Pi, and port 222 to the server. To access them: 'ssh -p 223 ip_address -l user' – Matthijs Vk Mar 16 '16 at 16:12
0

Your home network most likely only has one single (public) IP address that can be reached from the outside. This is the address assigned to your router. If you configure port forwarding, the following happens: You configured port 22 to be forwarded to your pi. Now, if anyone contacts your router on it's ip and port 22, the router will forward those packets to your raspberry pi. For the outside person, it looks just as if your raspberry pi was behind the public ip, and not your router. Of course, you can not ssh to your server now, since your server can not listen on port 22 of the public ip adress! You would have to configure the servers ssh server to listen on some other port instead, and forward that port to the server!

  • Yes, that's what I did. The server is on a different port than the pi, and forwarding is configured for both. So if I want to access the server, I use 'ssh -p 1234 ....' and for the pi just 'ssh .....', right? – Matthijs Vk Mar 16 '16 at 15:48
  • Hm. That should be correct. So say your ip address was 123.123.123.123. Your command for accessing the pi would be ssh -p 22 piuser@123.123.123.123 while for accessing the server it would be ssh -p 1234 serveruser@123.123.123.123 of course, the -p 22 can be omitted because it is the standard port. Are you sure the port forwarding for the server is correct? Can you access other services running on the server on other ports? – Gasp0de Mar 16 '16 at 15:54
  • I tried the port I previously used for the server, let's say port 222, and the Pi works on that if I change the forward address. Every port that I forward to the Pi's address, is open (yougetsignal.com/tools/open-ports), but ports forwarded to the server remain closed. That's why I thought the problem was at the server side, and therefore I tried the sshd_config file from the Pi there. – Matthijs Vk Mar 16 '16 at 16:05
  • If at the same time, you can ssh into the pi but not the server with the same forwarding rule, the problem has to be with the server. Do you have iptables running on server oder router? – Gasp0de Mar 17 '16 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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