{"id":350,"date":"2024-08-06T00:15:39","date_gmt":"2024-08-06T00:15:39","guid":{"rendered":"http:\/\/taptronics.com\/taptronics\/?p=350"},"modified":"2024-08-07T13:46:14","modified_gmt":"2024-08-07T13:46:14","slug":"reaching-remote-mobile-device-without-having-a-static-ip-address","status":"publish","type":"post","link":"http:\/\/taptronics.com\/taptronics\/reaching-remote-mobile-device-without-having-a-static-ip-address\/","title":{"rendered":"Reaching Remote Mobile Device Without Having a Static IP Address ."},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-351\" src=\"http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2024\/08\/iMarkup_20240804_231645-300x300.jpg\" alt=\"\" width=\"300\" height=\"300\" srcset=\"http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2024\/08\/iMarkup_20240804_231645-300x300.jpg 300w, http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2024\/08\/iMarkup_20240804_231645-1024x1024.jpg 1024w, http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2024\/08\/iMarkup_20240804_231645-150x150.jpg 150w, http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2024\/08\/iMarkup_20240804_231645-768x768.jpg 768w, http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2024\/08\/iMarkup_20240804_231645-1536x1536.jpg 1536w, http:\/\/taptronics.com\/taptronics\/wp-content\/uploads\/2024\/08\/iMarkup_20240804_231645-2048x2048.jpg 2048w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>I have a Raspberry Pi\u00a0 which is located in a remote place. The only communication methods can be established\u00a0 is to use 4G LTE cellular networks with no static IP address provided. Can I reach my Raspberry Pi from my computer or from my smartphone, also assuming both devices don&#8217;t have static IP addresses ?\u00a0 Absolutely. As long as there is a SSH server which has a static IP address that\u00a0 can be accessed from both sides, I can retrieve or send data from my computer to Raspberry Pi.<\/p>\n<p>Raspberry Pi needs to establish a route using reverse tunnel or known as a remote forwarding. It routes a traffic to local machine which in this case is &#8220;my computer&#8221; or other destinations. Since my computer doesn&#8217;t have a static IP address, the traffic can be routed to SSH server which has a static IP address.<\/p>\n<p>For all connections here, we use private and public keys so we will not be required to enter password everytime we connect to the server.<\/p>\n<p><em><strong>SSH Reverse Tunnel or Remote Forwarding<\/strong><\/em>.<\/p>\n<p>On Raspberry pi we will enter the following:<\/p>\n<p>ssh -v -i \/home\/pi\/serverkey -R 5112:localhost:22 -p 22 myaccount@107.175.72.199<\/p>\n<p style=\"text-align: right;\">My user id on ssh server is myaccount. For connecting to the server , it has a port 22 for ssh and an IP address 107.175.72.199. Serverkey which is stored in directory \/home\/pi\u00a0 is a private key which has to match a ssh server public key.<\/p>\n<p>Here is the important part:<\/p>\n<p>-R 5112:localhost:22<\/p>\n<p>-R means remote forwarding. It will route port 22 on Raspberry pi to destination port 5112 which is located on ssh server.<\/p>\n<p>-i identify file.<\/p>\n<p>-v verbose.<\/p>\n<p><em><strong>SSH Tunnel or Local Forwarding.<\/strong><\/em><\/p>\n<p>On my computer which has own a ssh server , I can access destination port 5112 that will route the traffic to Raspberry Pi port 22 using following command:<\/p>\n<p>ssh -v -i \/home\/mycomputer\/serverkey -L 5112:localhost:22 -p 22 myaccount@107.175.72.199<\/p>\n<p>I can also connect the Raspberry Pi using my phone with a SSH client installed.<\/p>\n<p>After connection established and able to login to 107.175.72.199 server, the last step is to login to Raspberry SSH terminal:<\/p>\n<p>ssh -i pikey -p 5112 pi@localhost<\/p>\n<p>pikey is\u00a0 an identity file for a private key that must match Raspberry pi public key.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a Raspberry Pi\u00a0 which is located in a remote place. The only communication methods can be established\u00a0 is to use 4G LTE cellular networks with no static IP address provided. Can I reach my Raspberry Pi from my computer or from my smartphone, also assuming both devices don&#8217;t have static IP addresses ?\u00a0 &hellip; <a href=\"http:\/\/taptronics.com\/taptronics\/reaching-remote-mobile-device-without-having-a-static-ip-address\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Reaching Remote Mobile Device Without Having a Static IP Address .<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/posts\/350"}],"collection":[{"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/comments?post=350"}],"version-history":[{"count":17,"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/posts\/350\/revisions"}],"predecessor-version":[{"id":371,"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/posts\/350\/revisions\/371"}],"wp:attachment":[{"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/media?parent=350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/categories?post=350"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/taptronics.com\/taptronics\/wp-json\/wp\/v2\/tags?post=350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}