We are about to deploy some of the gateway devices (Raspberrypi) in the field. Although we are trying to make them so robust that we should not be required to remotely access them but as this is one of POC, we are taking a measure to remotely debug them.
Set-up is like this, that we have a RPI that is acting as a data aggregator for other wireless devices. We just want to access the log and run some commands remotely if required. Now i am running a ssh server on my RPI and listening on default 22 port (we can change the port). Now this RPI is connected to a Reliance JIO wifi device whose port forward section looks like this
I used local port and WAN port both as 22 and MAC address as my laptop Wifi MAC address. Now i got my public IP using below command curl ipinfo.io/ip
. Now i used one of my digital ocean server and tried to ssh using
ssh <username>@<IP> -p<PORT number which is 22>
, but still i am not able to access my machine and i am not able to figure out the reason behind that. Can any one guide me or at least point out the mistake which i am doing.
Note:- Also at present, i am using ngrock
which allow only one ngrok
process and with command ./ngrok tcp 22
you are able to get a customised IP from ngrok and can use the same to access the system without doing anything on router. This is good till the time you are testing on one machine. My main aim is to write a small python script which keep on posting the current IP of RPI to a web-server and update the IP if there is a change. I can then use the same IP to ssh my machine.
Edit-1 - I used online port scanner canyouseeme.org and found that port 22 is not open in my Reliance Wifi device in spite of the fact that i forwarded port 22 (if this mean opening port 22). Also i tried the same with my Dlink Router DIR-816. Below is the attached image and when i used online port scanner, it say that Error: I could not see your service on XX.XX.XX.XX on port (22)
Reason: No route to host
. I am using ACT fibernet - a one of broadband service here in Bangalore. When i run traceroute
from one of my digital ocean server, i was able to see my IP.
Edid -2 As suggested i used a different WAN port and tried the online port scanner and came up with same error connection timed out
. Also the output of netstat -anutp | grep :22
is
$ netstat -anutp | grep :22
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 252 192.168.0.100:37043 XX.XX.XX.XX:22 ESTABLISHED -
tcp6 0 0 :::22 :::* LISTEN -
Is there is a possibility that my ISP is blocking this port or any incoming port request. But at the same time when i used ngrok
, everything works fine. Problem with ngrok is, its a paid service and in free plan allow only one instance and i don't want to end-up paying $100 for ssh only.
ifconfig
andnetstat -anutp | grep :22
on your laptop and a test the open port from Internet with your firewall disabled?connection time out
. I am adding the output of netstat in my question in Edit-2