Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listening on non-localhost does not work on Windows #7941

Open
mook-as opened this issue Dec 13, 2024 · 2 comments
Open

Listening on non-localhost does not work on Windows #7941

mook-as opened this issue Dec 13, 2024 · 2 comments
Labels
area/networking kind/bug Something isn't working platform/windows qase Issue is related to manual test in Qase

Comments

@mook-as
Copy link
Contributor

mook-as commented Dec 13, 2024

Actual Behavior

When a moby container listens on all interfaces, from the host only the localhost port is available.

This is from Qase test RD-55. It's possible that the test case needs to be modified instead.

Steps to Reproduce

  1. Install Rancher Desktop as a normal user (non-admin install)
  2. Start Rancher Desktop with moby container engine, Kubernetes disabled.
  3. docker run -d --name hello-world -p 55043:80 strm/helloworld-http
  4. Try to connect to the container from a non-localhost address:

    Get-NetIPAddress -AddressFamily IPv4 | Select-Object -Property IPAddress | % { echo $_.IPAddress ; curl.exe "$($_.IPAddress):55043" }

Result

Only connection to localhost works:

172.26.64.1
curl: (7) Failed to connect to 172.26.64.1 port 55043 after 2055 ms: Could not connect to server
172.23.242.45
curl: (7) Failed to connect to 172.23.242.45 port 55043 after 2057 ms: Could not connect to server
127.0.0.1
<html><head><title>HTTP Hello World</title></head><body><h1>Hello from ab5822d60517</h1></body></html>

Expected Behavior

Connections to non-localhost addresses should work.

Additional Information

rancher-desktop-guestagent.log:

2024/12/13 13:21:03 [INFO]    Starting Rancher Desktop Agent in [AdminInstall=false] mode
2024/12/13 13:21:03 [INFO]    /proc/net scanner enabled /proc/sys/net/ipv4/conf/eth0/route_localnet
2024/12/13 13:21:08 [DEBUG]   checking if container engine API is running at /var/run/docker.sock
2024/12/13 13:21:13 [DEBUG]   checking if container engine API is running at /var/run/docker.sock
2024/12/13 13:21:18 [DEBUG]   checking if container engine API is running at /var/run/docker.sock
2024/12/13 13:24:42 [INFO]    /proc/net scanner added port: 55043/tcp -> [{HostIP:0.0.0.0 HostPort:55043}]
2024/12/13 13:24:42 [DEBUG]   called add with portProto: 55043/tcp, portBindings: [{HostIP:0.0.0.0 HostPort:55043}]
2024/12/13 13:24:42 [DEBUG]   exposing the following port binding: {HostIP:0.0.0.0 HostPort:55043}
2024/12/13 13:24:42 [DEBUG]   sending a HTTP POST to /services/forwarder/expose API with expose request: &{127.0.0.1:55043 192.168.127.2:55043 tcp}
2024/12/13 13:24:42 [DEBUG]   portStorage add status: map[292b783e406c2a74ae0afe9439b21689aed6f8a84704365dd52f8486578162c8:map[55043/tcp:[{HostIP:0.0.0.0 HostPort:55043}]]]
2024/12/13 13:24:42 [DEBUG]   forwarding to wsl-proxy to add port mapping: {Remove:false Ports:map[55043/tcp:[{HostIP:0.0.0.0 HostPort:55043}]] ConnectAddrs:[]}
2024/12/13 13:24:43 [DEBUG]   received an event: {Status: start ContainerID: ab5822d60517a08eda39315b645084ecc5dc01a1766972867f0d38044b1b8752 Ports: map[80/tcp:[{HostIP:0.0.0.0 HostPort:55043} {HostIP::: HostPort:55043}]]}
2024/12/13 13:24:43 [DEBUG]   called add with portProto: 80/tcp, portBindings: [{HostIP:0.0.0.0 HostPort:55043} {HostIP::: HostPort:55043}]
2024/12/13 13:24:43 [DEBUG]   exposing the following port binding: {HostIP:0.0.0.0 HostPort:55043}
2024/12/13 13:24:43 [DEBUG]   sending a HTTP POST to /services/forwarder/expose API with expose request: &{127.0.0.1:55043 192.168.127.2:55043 tcp}
2024/12/13 13:24:43 [ERROR]   did not receive IPv4 for HostIP: ::
2024/12/13 13:24:43 [ERROR]   adding port mapping to tracker failed: error from /services/forwarder/expose API: [exposing {HostIP:0.0.0.0 HostPort:55043} failed: error from API: listen tcp 127.0.0.1:55043: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.]

Rancher Desktop Version

1.17.0-g77398647d

Rancher Desktop K8s Version

N/A

Which container engine are you using?

moby (docker cli)

What operating system are you using?

Windows

Operating System / Build Version

Windows 11 Pro 23H2 (Build 22631.4602)

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

VM install

@mook-as mook-as added kind/bug Something isn't working platform/windows area/networking qase Issue is related to manual test in Qase labels Dec 13, 2024
@Nino-K
Copy link
Member

Nino-K commented Dec 16, 2024

This could be related to the factory-reset issue filed here: #7940. I tried to repro this and I can observe the following:
I manually performed a factory reset (by deleting distros, and even did wsl --shutdown), I then followed the test steps and everything seems to be working fine:

> ipconfig | findstr /R /C:"vEthernet (WSL)" /C:"IPv4 Address"
   IPv4 Address. . . . . . . . . . . : 10.0.0.98
Ethernet adapter vEthernet (WSL):
   IPv4 Address. . . . . . . . . . . : 172.27.176.1
> curl.exe 10.0.0.98:55043
<html><head><title>HTTP Hello World</title></head><body><h1>Hello from dd605cd4efcc</h1></body></html
> curl.exe localhost:55043
<html><head><title>HTTP Hello World</title></head><body><h1>Hello from dd605cd4efcc</h1></body></html
> curl.exe 172.27.176.1:55043
<html><head><title>HTTP Hello World</title></head><body><h1>Hello from dd605cd4efcc</h1></body></html

However, after performing a factory reset it all gets into this state and causes the following failures:

> curl.exe 172.27.176.1:55043
curl: (7) Failed to connect to 172.27.176.1 port 55043 after 2028 ms: Could not connect to server
> curl.exe localhost:55043
curl: (7) Failed to connect to localhost port 55043 after 2256 ms: Could not connect to server
> curl.exe 10.0.0.98:55043
curl: (7) Failed to connect to 10.0.0.98 port 55043 after 2044 ms: Could not connect to server

Although the issue mentioned above that it works on localhost, it also fails for me on localhost after a factory reset.

@mook-as
Copy link
Contributor Author

mook-as commented Dec 20, 2024

This is still broken with 1.17.0-hackweek-release-263-gd6d6b5174 (i.e. d6d6b51 which contains the factory reset fixes). I've run factory reset, deleted all WSL distributions, and restarted the host; the issue persists.
logs.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking kind/bug Something isn't working platform/windows qase Issue is related to manual test in Qase
Projects
None yet
Development

No branches or pull requests

2 participants