Accessing a server running under WSL2

    I wanted to tidy away a server and mover to using docker containers under WSL. That's a story for another day.

    But when I have a server running in my docker container, that I can happily access via https://localhost:9443, how do I access it from the local LAN. I.e., use

    There is a lot written on this and the [[][problems associated with it].

    What to do.

    There are scripts that never quite worked for me.

    One of the problems is that WSL2 gets a new IP address with each reboot. Arrgh!.

    My simple solution was to proxy traffic that comes to the target port to the localhost (and thence automagically to WSL2), like this.

    Using powershell in Administration mode I did this proxy:

      netsh interface portproxy add v4tov4 listenport=9443 listenaddress= connectport=9443 connectaddress=

    Great. On my machine running WSL (, I can now access the server as

    All I need to do is to expose that port now, so that systems on local LAN can get through Windows Firewall. Back in powershell I run wf and set a rule to allow access to port 9443 on this machine (

    Yay! It all works.

    If you webmention this page, please let me know the URL of your page.

    BTW: Your webmention won't show up until I next "build" my site.

    Word count: 200 (about 1 minutes)


    Updated: 20 Nov '23 19:56

    Author: Peter Smith


    Section: blog

    Kind: page

    Bundle type: leaf

    Source: blog/2023/11/20/accessing-server-on-wsl2/