Access your LAN behind a 4G router, from the outside, with ngrok

 

Because of the finite IPv4 address, the ISPs in some countries/regions provide private IP addresses as WAN IP for 3G/4G network. For this reason, it is not possible to open ports and access devices in LAN like NAS,IP camera or Web server ... 

 

 

If you want to access certain equipment on your LAN, several techniques can be used and ngrok is one of them. 

 

Here I'll share how I've managed to access my web server behind Archer MR600 using ngrok :

 

To implement this solution, you must:

1- Create an account on ngrok.com (optional)

2- Install the ngrok client on the machine, in my case it was a linux machine, but the instructions are easily transposed to another PC / OS.

 

Steps

 

1- Install ngrok :

 

wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.zip      #download

unzip ngrok-stable-linux-arm.zip     #unzip 

rm ngrok-stable-linux-arm.zip       #delete the zip file 

 

2- Configure the authtoken : (optional) the authtoken can be found in your dashboard after creating the account

./ngrok authtoken xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

3- run 

./ngrok http 80

 

** my server was running on port 80 , you must change the port number if you server is running on another port 

 

ngrok will display a UI in the terminal with the public URL of the tunnel and other status and metrics information about connections made over the tunnel.

 

 

4- access the server with the forwarding URL

 

That’s it – quick and easy

 

Bonus

 

What if you want to access other devices like a NAS ?

 

In this case you must run ngrok on a machine that will route the traffic to other device in LAN ,

for example if you want to access the Web GUI of your NAS ,you can setup ngrok on a Raspberry Pi or a PC , then execute the following command:

 

ngrok http  192.168.0.100:80

where 192.168.0.100 is the IP of your NAS , and 80 is the port number.

 

 

 

 

9

Comment

Thank you

Hello, World ! Wi-Fi

​​​​​​​

Witam, mam taki problem z sms-em nie wyswietla do routera sms Archer MR600, znowu musze zrestartowac router do stanu fabrycznego i wtedy wraca do normy. 

 

Hello,

 

Great solution ! I was looking for a way to access to my Raspberry's server, behing a 4G router... that's the first time something works (with my level of network knowledge...)  ! Thank you very much.

 

Tip : a very simple way to automatically launch the function, at Raspberry start : search on github.com for /vincenthsu/systemd-ngrok

 

Limitation : "Forwarding" adress changes at every restart :-( Except if you pay for an upgrade... Intermediate solution is to log on the Ngrok account, and get the updated public adress in "Endpoint" area.

 

Big thanks for this solution, and big thanks to TP link support team, that shared it to me.

upload
    upload
      Subscriptions