Skip to content

Prefer WSL2 internal IP to external IP #12

@RolandRosier

Description

@RolandRosier

In WSL2, there is an internal network created between Windows and WSL2, with the range 172.16.0.0/12.

Whilst X-Windows servers such as VcSrv are likely to listen on the generic IP 0.0.0.0, port 6XXX, a security-minded PC setup should block all incoming connections from the externally-facing interfaces (e.g. Ethernet, WiFi) and only allow connections from the internal network.

Therefore, when looking for the Host IP of the X-Server running on Windows, WSL2 should connect to the internal IP.

There are multiple ways that this internal IP can be dynamically determined. One way is:
ip route list default | awk '{print $3}'

Every time that WSL2 is restarted (including when the PC is rebooted), the address assigned to the WSL2 instance and to the Windows host can potentially change, so the determination of the Host IP address should use one of the mechanisms for determining the changing IP.

(Note: This security mechanism of using the firewall to block incoming connections from externally-facing interfaces can be used to enhance the xauth mechanism - providing greater defense-in-depth for the system).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy