{"id":347,"date":"2024-03-05T01:12:29","date_gmt":"2024-03-04T23:12:29","guid":{"rendered":"https:\/\/gronlier.fr\/blog\/?p=347"},"modified":"2024-03-05T01:16:11","modified_gmt":"2024-03-04T23:16:11","slug":"automate-ssh-reverse-tunnel-for-remote-access-to-local-network","status":"publish","type":"post","link":"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/","title":{"rendered":"Automate SSH reverse tunnel for remote access to local network"},"content":{"rendered":"\n<p>A RPi is deployed in an unknown local network and should connect to a public jump box. Later a user could connect to the jump box to reach the local network via the reverse tunnel.<\/p>\n<h1>Configure your RPi<\/h1>\n<p>I used a Debian 11.8 on a RPi v1 (2011.12) and install autossh and configure your reverse tunnel<\/p>\n<p>example to bind 0.0.0.0:10022 on the onlinejumpbox and forward it to the RPi localhost:22 SSH server.<\/p>\n<pre>ssh -R 0.0.0.0:10022:localhost:22 debian@onlinejumpbox<\/pre>\n\n\n\n<p>Create and install a service with systemd in the file <strong>\/etc\/systemd\/system\/tunnel.service<\/strong><\/p>\n<pre>[Unit]<br \/>Description=SSH tunnel service<br \/>After=network.target network-online.target sshd.service<br \/>#After=sshd.service<br \/><br \/>[Service]<br \/>ExecStart=\/usr\/bin\/autossh -i \/home\/debian\/.ssh\/id_rsa -R 0.0.0.0:10022:localhost:22 -NT debian@onlinejumpbox<br \/>Restart=always<br \/>RestartSec=30<br \/><br \/>[Install]<br \/>WantedBy=multi-user.target<\/pre>\n\n\n\n<p>Optional: in <strong>\/etc\/ssh\/sshd_config<\/strong> set<\/p>\n<pre>PasswordAuthentication no<\/pre>\n\n\n\n<h1>Configure the server<\/h1>\n<p>Optional: if you want the bind_address parameter to work, in <strong>\/etc\/ssh\/sshd_config<\/strong> set<\/p>\n<pre>GatewayPorts yes<\/pre>\n\n\n\n<h1>Conclusion<\/h1>\n<p>A user can reach the local network via this command line<\/p>\n<pre>ssh -p 10022 debian@onlinejumpbox<\/pre>\n<div class='skype-share' data-href='https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/' data-lang='auto' data-style='large' data-source='WordPress' ><\/div><div style='clear:both;padding-bottom:10px;'><\/div>\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=ticapix\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>A RPi is deployed in an unknown local network and should connect to a public jump box. Later a user could connect to the jump box to reach the local network via the reverse tunnel. Configure your RPi I used a Debian 11.8 on a RPi v1 (2011.12) and install autossh and configure your reverse &hellip; <a href=\"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Automate SSH reverse tunnel for remote access to local network<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3,10],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Automate SSH reverse tunnel for remote access to local network - Bits and Bytes<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Automate SSH reverse tunnel for remote access to local network - Bits and Bytes\" \/>\n<meta property=\"og:description\" content=\"A RPi is deployed in an unknown local network and should connect to a public jump box. Later a user could connect to the jump box to reach the local network via the reverse tunnel. Configure your RPi I used a Debian 11.8 on a RPi v1 (2011.12) and install autossh and configure your reverse &hellip; Continue reading Automate SSH reverse tunnel for remote access to local network &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/\" \/>\n<meta property=\"og:site_name\" content=\"Bits and Bytes\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-04T23:12:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-04T23:16:11+00:00\" \/>\n<meta name=\"author\" content=\"ticapix\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ticapix\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/\",\"url\":\"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/\",\"name\":\"Automate SSH reverse tunnel for remote access to local network - Bits and Bytes\",\"isPartOf\":{\"@id\":\"https:\/\/gronlier.fr\/blog\/#website\"},\"datePublished\":\"2024-03-04T23:12:29+00:00\",\"dateModified\":\"2024-03-04T23:16:11+00:00\",\"author\":{\"@id\":\"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/9abd8d0260a4d942d7069de75446e2bc\"},\"breadcrumb\":{\"@id\":\"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/gronlier.fr\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automate SSH reverse tunnel for remote access to local network\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/gronlier.fr\/blog\/#website\",\"url\":\"https:\/\/gronlier.fr\/blog\/\",\"name\":\"Bits and Bytes\",\"description\":\"As the default template said: &quot;Just another WordPress site&quot;\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/gronlier.fr\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/9abd8d0260a4d942d7069de75446e2bc\",\"name\":\"ticapix\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/94bba7228ec3665afea02078abebfa94?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/94bba7228ec3665afea02078abebfa94?s=96&d=monsterid&r=g\",\"caption\":\"ticapix\"},\"url\":\"https:\/\/gronlier.fr\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Automate SSH reverse tunnel for remote access to local network - Bits and Bytes","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/","og_locale":"en_US","og_type":"article","og_title":"Automate SSH reverse tunnel for remote access to local network - Bits and Bytes","og_description":"A RPi is deployed in an unknown local network and should connect to a public jump box. Later a user could connect to the jump box to reach the local network via the reverse tunnel. Configure your RPi I used a Debian 11.8 on a RPi v1 (2011.12) and install autossh and configure your reverse &hellip; Continue reading Automate SSH reverse tunnel for remote access to local network &rarr;","og_url":"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/","og_site_name":"Bits and Bytes","article_published_time":"2024-03-04T23:12:29+00:00","article_modified_time":"2024-03-04T23:16:11+00:00","author":"ticapix","twitter_card":"summary_large_image","twitter_misc":{"Written by":"ticapix","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/","url":"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/","name":"Automate SSH reverse tunnel for remote access to local network - Bits and Bytes","isPartOf":{"@id":"https:\/\/gronlier.fr\/blog\/#website"},"datePublished":"2024-03-04T23:12:29+00:00","dateModified":"2024-03-04T23:16:11+00:00","author":{"@id":"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/9abd8d0260a4d942d7069de75446e2bc"},"breadcrumb":{"@id":"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gronlier.fr\/blog\/2024\/03\/automate-ssh-reverse-tunnel-for-remote-access-to-local-network\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gronlier.fr\/blog\/"},{"@type":"ListItem","position":2,"name":"Automate SSH reverse tunnel for remote access to local network"}]},{"@type":"WebSite","@id":"https:\/\/gronlier.fr\/blog\/#website","url":"https:\/\/gronlier.fr\/blog\/","name":"Bits and Bytes","description":"As the default template said: &quot;Just another WordPress site&quot;","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gronlier.fr\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/9abd8d0260a4d942d7069de75446e2bc","name":"ticapix","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/94bba7228ec3665afea02078abebfa94?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/94bba7228ec3665afea02078abebfa94?s=96&d=monsterid&r=g","caption":"ticapix"},"url":"https:\/\/gronlier.fr\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/posts\/347"}],"collection":[{"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/comments?post=347"}],"version-history":[{"count":2,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/posts\/347\/revisions"}],"predecessor-version":[{"id":350,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/posts\/347\/revisions\/350"}],"wp:attachment":[{"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/media?parent=347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/categories?post=347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/tags?post=347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}