1

Following this question I issued this command as an admin thorough PowerShell:

netsh interface portproxy add v4tov4 listenport=4000 listenaddress=0.0.0.0 connectport=4000 connectaddress=(wsl hostname -i)

Unfortunately, I know zero about netsh and blindly ran code I don't understand.

Now, in my alpine WSL2 I cannot apk update:

~# apk update
fetch https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
WARNING: updating https://dl-cdn.alpinelinux.org/alpine/edge/main: Permission denied
fetch https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
WARNING: updating https://dl-cdn.alpinelinux.org/alpine/edge/community: Permission denied
v20231219-2427-gd0dda5e6861 [https://dl-cdn.alpinelinux.org/alpine/edge/main]
v20231219-2427-gd0dda5e6861 [https://dl-cdn.alpinelinux.org/alpine/edge/community]
0 unavailable, 2 stale; 23217 distinct packages available

First suggestion was to, as far as I understand, reset the proxy as in this question

  1. This question addresses another issue not related to WSL2 and the answer is for Win8.
  2. I am hesitant of running netsh winhttp reset proxy as this computer's proxy was setup by someone else and the machine needs to keep that configuration. Also, Windows itself has no problem talking to the internet. The command might reset a setting, but it will also do more that reverting only one command: it might revert even thousands of them.
  3. Under Control Panel > Internet Options > Connections (tab) I see no connections to delete.
scjorge
  • 339

1 Answers1

1

To address reverting the netsh-command I learned that

  1. netsh interface portproxy ... is used to set up a port forwarding rule

  2. I can check all such rules with netsh interface portproxy show all. In my case I found:

Abfragen auf ipv4:             Verbinden mit ipv4:

Adresse Anschluss Adresse Anschluss


... 0.0.0.0 4000 127.0.1.1 4000 ...

127.0.1.1 is what wsl.exe hostname -i gives as an output.

  1. I can delete this rule with the following command
netsh interface portproxy delete v4tov4 listenport=4000 listenaddress=0.0.0.0 
  1. This deletes all rules with listenport=4000 listenaddress=0.0.0.0 and "reverts"
netsh interface portproxy add v4tov4 listenport=4000 listenaddress=0.0.0.0 connectport=4000 connectaddress=(wsl hostname -i)

Now, addressing the WSL2-networking capabilities, I have to say that this is related to the Windows firewall. See: https://gitlab.alpinelinux.org/alpine/aports/-/issues/11824

Using a different internet connection solved it.

scjorge
  • 339