MicrosoftDocs / WSL

Source code behind the Windows Subsystem for Linux documentation.
https://docs.microsoft.com/windows/wsl
Other
1.89k stars 556 forks source link

/etc/resolv.conf does not intend to provide the computer IP address #1810

Closed lauguillier closed 8 months ago

lauguillier commented 11 months ago

Documentation Issue

In https://learn.microsoft.com/en-us/windows/wsl/networking it is written "Obtain the IP address of your host machine by running this command from your Linux distribution: cat /etc/resolv.conf"; This is a wrong advice, as this file is intended to provide Domain Name Server addresses to the resolver, as stated in the manual page (https://manned.org/resolv.conf.5). It is not at all related to the computer IP address, unless relying on a twist made by automated generation of this file when this option is activated.

Link to documentation page

https://learn.microsoft.com/en-us/windows/wsl/networking

Suggested Improvements

You can get the computer IP address by using "ip addr" (see https://manned.org/ip.8)

Biswa96 commented 11 months ago

I think, "IP address of your host virtual network interface" would be better instead of "IP address of your host machine".

The output of ip addr may be little bit confusing for new users. Alternatively, some PowerShell commands can be used to get the IP address from Windows side.

craigloewen-msft commented 8 months ago

We've updated the docs here to be clearer! Thank you for the feedback :)

https://learn.microsoft.com/en-us/windows/wsl/networking#:~:text=Obtain%20the%20IP%20address%20of%20your%20host%20machine%20by%20running%20this%20command%20from%20your%20Linux%20distribution%3A%20%60%20ip%20route%20show%20%7C%20grep%20%2Di%20default%20%7C%20awk%20%27%7B%20print%20%243%7D%27