Post

TIL - WSL2 Mirrored Network Mode

Found this trying to ressurect this ‘blog’:

Microsoft recently added a “Mirrored” networking mode that makes WSL2 and Windows share the same network stack. This makes localhost behave exactly like it does on a Mac or Linux machine.

In Windows, go to your user folder: C:\Users<YourUsername>.

  1. Create (or edit) a file named .wslconfig. Add these lines:

    1
    2
    
     [wsl2]
     networkingMode=mirrored
    
  2. Open PowerShell as Administrator and restart WSL:

    1
    
     wsl --shutdown
    
  3. Restart your Jekyll server.

Now, localhost:4000 should just work without the –host flag.

This post is licensed under CC BY 4.0 by the author.