Skip to content

Commit 1f60599

Browse files
authored
Correct hostname flags and command references in networking documentation. (#2429)
Updated the networking documentation to use the correct hostname flags and commands: - Replaced `hostname -i` with `hostname -I` - Updated `hostname --ip-addresses` to `hostname --all-ip-addresses` - Ensured command explanations align with actual Linux behavior These changes improve accuracy and prevent confusion for users querying IP addresses in WSL.
1 parent bf6b647 commit 1f60599

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

WSL/networking.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ There are two scenarios to consider when identifying the IP address used for a L
2020
The Windows host can use command:
2121

2222
```powershell
23-
wsl.exe --distribution <DistroName> hostname -i
23+
wsl.exe --distribution <DistroName> hostname -I
2424
```
2525

2626
If querying the default distribution, this part of the command designating the distribution can be omitted: `-d <DistroName>`. Be sure to use a lower-case `-i` flag.
2727

28-
Under the hood, host command wsl.exe launches the target instance and executes Linux command `hostname --ip-addresses`. This command then prints the IP address of the WSL instance to `STDOUT`. The `STDOUT` text content is then relayed back to wsl.exe. Finally, wsl.exe displays that output to the command line.
28+
Under the hood, host command wsl.exe launches the target instance and executes Linux command `hostname --all-ip-addresses`. This command then prints the IP address of the WSL instance to `STDOUT`. The `STDOUT` text content is then relayed back to wsl.exe. Finally, wsl.exe displays that output to the command line.
2929

3030
A typical output might be:
3131

@@ -115,7 +115,7 @@ Using `listenaddress=0.0.0.0` will listen on all [IPv4 ports](https://stackoverf
115115

116116
## IPv6 access
117117

118-
- `wsl hostname -i` for the IP address of your Linux distribution installed via WSL 2 (the WSL 2 VM address)
118+
- `wsl hostname -I` for the IP address of your Linux distribution installed via WSL 2 (the WSL 2 VM address)
119119
- `ip route show | grep -i default | awk '{ print $3}'` for the IP address of the Windows machine as seen from WSL 2 (the WSL 2 VM)
120120

121121
Using `listenaddress=0.0.0.0` will listen on all [IPv4 ports](https://stackoverflow.com/questions/9987409/want-to-know-what-is-ipv4-and-ipv6#:~:text=The%20basic%20difference%20is%20the,whereas%20IPv6%20has%20128%20bits.).

0 commit comments

Comments
 (0)