what is TUNNELing
Posted by kll on September 19 2021 11:41:01
many times i have a webserver like on RPI / ESP
what works fine inside my LAN,
but if want to show it to someone outside there is the basic idea
of port forward.. a setting in your router, if from outside someone
calls you current IP ( you need to find out and tell him )
and he calls it adding a port you configured for your webserver..
the router will connect him to your local_IP:port

but with many ISP that not work anymore...
* companies ( with own servers ) would buy a not cheap fixIP line anyway.

but for short temporary tests:
i need a TUNNEL



from some webinfo like here and here
i got the idea to test NGROK

with or without account ( anyway not yet buy a paid service )
download a program
ngrok
* i try it on windows 10 PC and on Raspberry Pi ( linux arm version )
* if you have a account ( my confirmation email took 2 days?? )
you need to use the
ngrok --authtoken xyz...
what you get after login to your ( confirmed ) accout

again for understanding this service program must run inside your LAN
( but not need to be on the device with the webserver )

but you must tell it where to link to:
http://192.168.1.219:8888 ( in my case a ESP32 with a little measuring data page )


so after i had that service program running, telling me a "public"
web page for the outsider to call like
http://N. 192.168.1.219:8888
i needed a first test:
local:
mobile WIFI browser: http://192.168.1.219:8888

remote:
mobile ( with WIFI OFF to be sure i not talk my LAN )
http://0.tcp.ngrok.io.12345

checkout also the local webinterface


besides you might find my local path confusing...
on RPI4 desktop i have:
ngrak_tunnel_start.desktop[Desktop Entry]
Version=1.0
Name=TUNNEL_start
Name[en_GB]=TUNNEL_start
Comment='NGROK tunnel'
Exec=lxterminal -e '/home/pi/Downloads/TUNNEL_ngrok/start'
Icon=kll_favicon.png
Terminal=false
Type=Application
Categories=Utility;KLL;
StartupNotify=true


and in that working path is the ngrok app
and above called
start#!/bin/sh
# ngrok start
MYPATH='/home/pi/Downloads/TUNNEL_ngrok'

echo 'try start ngrok to open tunnel for ESP32 webserver to OUTSIDE'

cd $MYPATH
ls
echo 'start, if it works you can call from browser http://x.tcp.ngrok.io.123456'
# where x and 123456 can change at every start
# you can find it in the following terminal window
./ngrok tcp 192.168.1.219:8888 --authtoken yyyy
# here yyyy is your token you get at login


this will link anyone you give the
http://x.tcp.ngrok.io.123456
to your local server,
here to my ESP32 Power Meter web page
about that more info here