Get a WSL Distro IP Address

Powershell, Windows, WSL (Windows Subsystem for Linux)
Words: 104 | Characters: 563 | Reading Time: 1 minutes

Getting the IP Address via Powershell #

Get the IP address for the default distribution #

If the default distro is not running, this will start the default distro and return the IP once running.

PS> wsl hostname -I
192.168.78.100

Get the IP address for a non-default distribution #

List all of the running WSL distributions (omit --running flag to list all, regardless of state).

PS> wsl -l --running
Windows Subsystem for Linux Distributions:
Ubuntu (Default)
Arch

Get the IP for the specific distribution with wsl -d <distro> hostname -I.

PS> wsl -d "Ubuntu" hostname -I
192.168.78.100

PS> wsl -d "Arch" hostname -I
192.168.78.110