{"id":467,"date":"2026-02-12T17:15:35","date_gmt":"2026-02-13T01:15:35","guid":{"rendered":"https:\/\/junsun.net\/wordpress\/?p=467"},"modified":"2026-02-12T17:15:35","modified_gmt":"2026-02-13T01:15:35","slug":"ssh-into-wsl2-on-windows","status":"publish","type":"post","link":"https:\/\/junsun.net\/wordpress\/2026\/02\/ssh-into-wsl2-on-windows\/","title":{"rendered":"SSH into WSL2 on windows"},"content":{"rendered":"\n<p>I have playing with WSL2 (Ubuntu 24.04) and toying with idea maybe it can become my primary linux dev environment and replace the cumbersome vmware player setup.  One hiccup I had yesterday was that  I could not ssh into wsl2.  And apparently even with powerful AI agent (Gemini in this case) I couldn&#8217;t get it resolved until this morning.<\/p>\n\n\n\n<h2>The Laptop<\/h2>\n\n\n\n<ul><li>It is running Windows 11 Home Edition.  As a result hyper-V is based solution is not available, specifically the bridged networking mode is not availabe.<\/li><li>I used the mirrored networking mode.<\/li><\/ul>\n\n\n\n<h2>The Key to Success<\/h2>\n\n\n\n<ol><li>add hyper-v firewall to allow incoming traffic,  <code>New-NetFirewallHyperVRule -Name \"Allow WSL SSH\" -DisplayName \"Allow WSL SSH\" -Direction Inbound -Protocol TCP -LocalPorts 22 -Action Allow<\/code><\/li><li>Add the following lines to .wslconfig file<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;experimental]\r\nhostAddressLoopback=true\r\n<\/code><\/pre>\n\n\n\n<p>After that, you will need to shutdown wsl2 and restart it, <code>wsl --shutdown<\/code> .<\/p>\n\n\n\n<p>Below is the complete copy of my wslconfig file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;wsl2]\r\nnetworkingMode=mirrored\r\nprocessors=16\r\nmemory=24GB\r\nnestedVirtualization=true\r\n\r\n&#91;experimental]\r\nhostAddressLoopback=true\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I have playing with WSL2 (Ubuntu 24.04) and toying with idea maybe it can become my primary linux dev environment and replace the cumbersome vmware player setup. One hiccup I had yesterday was that I could not ssh into wsl2. And apparently even with powerful AI agent (Gemini in this case) I couldn&#8217;t get it &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/junsun.net\/wordpress\/2026\/02\/ssh-into-wsl2-on-windows\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;SSH into WSL2 on windows&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[3],"tags":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/posts\/467"}],"collection":[{"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/comments?post=467"}],"version-history":[{"count":1,"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/posts\/467\/revisions"}],"predecessor-version":[{"id":468,"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/posts\/467\/revisions\/468"}],"wp:attachment":[{"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/media?parent=467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/categories?post=467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/tags?post=467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}