I have a raspberry pi and I have a program which has to run only when I want it from an app. So, basically need to connect to my raspberry pi from public internet. Not sure about this, I think I need to make my raspberry pi ssh from public internet, i.e. connect directly through some IP address.
How can I do this? I am trying to connect to my linux system through simple ssh and its not working. Any guides and pointers to go about?
Thanks
First, you should make sure that the ssh daemon is installed properly on your RP. You can install it with
sudo apt-get update && apt-get install ssh
Next, you should try to connect to your SSH server locally, that means, open up a terminal directly on your RP and try to connect to your locally running SSH server:
ssh root@localhost
Or even better, use the current IP address of the RP instead of localhost. If you can connect, everything works on this side. Now you can try to connect to your RP from another box inside your local network. It should also work. If it does not, you most probably have a firewall blocking outgoing SSH connections on this box, or your RP itself is blocking incoming connections. Usually, it should not block it, unless you configured something like that with iptables, for example.
If you can connect within your LAN, you can take it one step further. You need to configure your router's firewall to forward the ports needed for SSH to your RP. Alternatively, many routers have offer the ability to put hosts into a so-called DMZ. This is quite useful for testing, as it gives you unrestricted access from the internet.
Next, you need to find out your public IP address on the WAN side. There are many sites like this that show your current external IP address. If everything is configured correctly, you should now be able to connect to root@[your external ip]. It should work from your local network as well as from the internet. Additionally, you should consider using a dynamic DNS service client either on your RP or in your router, so you can connect to a static hostname instead of changing dynamic IP addresses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With