7

WSL2 is used to create the 'vEthernet (WSL)' adapter with IP address 172.23.0.1 after each reboot. Worked fine so far, until our company decided to add another network on 172.23.0.0/20 and updated the routing table.

Problem

Now, network communication from and to WSL (Ubuntu) is not possible anymore, since every traffic to WSL gets routed to a different interface because fo the new route and gets lost in limbo. I observed that via Wireshark. Changing the route is not an option - I need to access the new network.

Option 1

I am looking for a way to tell WSL to use a different IP address when creating the 'vEthernet (WSL)' adapter after reboot (when you first start WSL). Unfortunately, it recreates the adapter each time using the same IP address. I have not found any information how or where to set a default IP for the WSL ethernet adapter.

Option 2

I tried assigning new IP addresses to the host adapter and Ubuntu according to https://gist.github.com/wllmsash/1636b86eed45e4024fb9b7ecd25378ce

  • changed vEthernet (WSL) adapter IP address to 172.30.0.1, removed 172.23.0.1
  • removed 172.23.x.x IP address from Ubuntu and added 172.30.0.2
  • replaced default route on Ubuntu with 172.30.0.1

I have aswell been trying around with the firewall rules for inbound/outbound traffic on the vEthernet (WSL) adapter.

Results:

  • I can successfully ping the Ubuntu machine from the windows host.
  • I can successfully pint the windows host (172.30.0.1) from the Ubuntu machine (after deleting and readding the firewall rules).
  • I can not access the internet from Ubuntu. I can only see the traffic from Ubuntu to windows host on the vEthernet (WSL) interface, but no more outgoing traffic on the normal network interface of the windows host.

Any hints whats missing? I'd prefer a solution regarding Option 1, since I am not really looking forward changing the network config of the WSL subsystem after each reboot.

2
  • I'm going to delete my answer for the moment while I investigate further. The problem you are experiencing is definitely different from the answer I provided -- You need to change the IP address/range of the virtual switch so that it doesn't overlap with the corporate internal network. If we can figure out how to do this, then yes, we may need to do the "reset" on the IP address itself, but that will be secondary. Commented Apr 21, 2023 at 16:44
  • If you haven't already, I'd suggest posting a WSL Issue on the Github repo. It may take someone from the WSL team to answer this. Commented Apr 22, 2023 at 0:05

1 Answer 1

2

A default IP for the WSL ethernet adapter (to wich it reboots) can be changed in regedit. See the answer here: https://learn.microsoft.com/en-us/answers/questions/1123820/set-wsl2-subnet

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented May 16, 2023 at 18:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .