WSL icon indicating copy to clipboard operation
WSL copied to clipboard

WSL 2 - Static MAC Address or Changing MAC After Booting Without Breaking Internet Connection

Open ghost opened this issue 6 years ago • 42 comments

Environment

Windows build number: 10.0.19041.264
Your Distribution version: Ubuntu 20.04
Whether the issue is on WSL 2 and/or WSL 1: WSL 2

Steps to reproduce

sudo ip link set dev eth0 down
sudo ip link set dev eth0 address 00:15:5d:09:b0:a0 # or any address, which will be fixed
sudo ip link set dev eth0 up

Expected behavior

IPv4 and IPv6 address can change(and would change), but the connection to the local physical machine and internet should be OK.

Actual behavior

I cannot use any program that requires to connect to the internet and GUI program which is attached to the local physical machine's vcxsrv X server.

ghost avatar Jun 06 '20 08:06 ghost

Was able to repro here.

therealkenc avatar Jun 07 '20 04:06 therealkenc

sudo ip route add default via (windows_side_ipconfig_vEthernet_ip) dev eth0 doesn't help.

ghost avatar Jun 09 '20 07:06 ghost

Yeah, I was all ready to dupe this user-error variation #4454 when you posted, but quickly figured out that's not it. I also looked to see if there was a way to modify the adapter properties from the Windows side (by mashing keys in powershell) but had no luck. I did find that putting the MAC address back the way it was does enable packets to route properly again. Which is of no use at all, except for the data point the damage is reversible.

therealkenc avatar Jun 09 '20 08:06 therealkenc

if there was a way to modify the adapter properties from the Windows side

HcnCreateNetwork -> HcnCreateEndpoint -> HcsModifyComputeSystem

Biswa96 avatar Jun 09 '20 12:06 Biswa96

I don't know the peoples in here how the issue faced on this, but I faced the licensing issue from this. Need to static hardware address for using License... Is there any other place to push this issue on Windows?

I'm desperate now.

mauver15 avatar Aug 14 '20 05:08 mauver15

I don't know the peoples in here how the issue faced on this, but I faced the licensing issue from this. Need to static hardware address for using License... Is there any other place to push this issue on Windows?

I'm desperate now.

Same reason. I just wrote a script that changes MAC for before and after checking the license.

ghost avatar Aug 18 '20 04:08 ghost

I have the same issue. I am trying to run MATLAB in WSL2 and get a license error every time I restart the WSL because the mac addresses change.

fritut08 avatar Aug 21 '20 08:08 fritut08

I filed a QnA to docs.microsoft but they commented there is no solution for this... Sadly, I'm gonna install the VMware or something.

https://docs.microsoft.com/en-us/answers/questions/73672/ubuntu-on-the-wsl2-fixed-mac-address-with-availabl.html

mauver15 avatar Aug 24 '20 13:08 mauver15

I have the same issue. I am trying to run MATLAB in WSL2 and get a license error every time I restart the WSL because the mac addresses change.

Hey fritut08, I solved the license problem derived from the non-supported static mac address. Below the guy "therealkenc" mentioned, you can use the "bond0" field to attach the license when issuing licenses.

mauver15 avatar Sep 28 '20 06:09 mauver15

I have the same issue. I am trying to run MATLAB in WSL2 and get a license error every time I restart the WSL because the mac addresses change.

Hey fritut08, I solved the license problem derived from the non-supported static mac address. Below the guy "therealkenc" mentioned, you can use the "bond0" field to attach the license when issuing licenses.

Hey mauver15, it does not work for me since MATLAB seems to use the mac address of eth0 when issuing the license but uses a combination of eth0 and bond0 when checking the license. So, whenever I start MATLAB after a restart of WSL2 it tries to compare the eth0 from when the license was issued with the current "eth0 bond0".

grafik

fritut08 avatar Sep 28 '20 07:09 fritut08

I have the same issue. I am trying to run MATLAB in WSL2 and get a license error every time I restart the WSL because the mac addresses change.

Hey fritut08, I solved the license problem derived from the non-supported static mac address. Below the guy "therealkenc" mentioned, you can use the "bond0" field to attach the license when issuing licenses.

Hey mauver15, it does not work for me since MATLAB seems to use the mac address of eth0 when issuing the license but uses a combination of eth0 and bond0 when checking the license. So, whenever I start MATLAB after a restart of WSL2 it tries to compare the eth0 from when the license was issued with the current "eth0 bond0".

grafik

Ok, I got it.

  1. Set the static mac address of the "bond0" field. Do change mac address to the address you are previously applied at the license. And this change does not affect your internet connection. (In your uploaded picture, there are two mac addresses that the license looks for. One is from eth0/other one is bond0) -> sudo ip link set dev bond0 address XX:XX:XX:XX:XX:XX

  2. Confirm that is your bond0's mac address fixed.

  3. Re-activate your license.

You can do this with the flows I wrote.

mauver15 avatar Sep 28 '20 07:09 mauver15

Ok, I got it.

1. Set the static mac address of the "bond0" field. Do change mac address to the address you are previously applied at the license.
   And this change does not affect your internet connection.
   (In your uploaded picture, there are two mac addresses that the license looks for. One is from eth0/other one is bond0)
   -> sudo ip link set dev bond0 address XX:XX:XX:XX:XX:XX

2. Confirm that is your bond0's mac address fixed.

3. Re-activate your license.

You can do this with the flows I wrote.

No, I do not think the bond0 address is the problem. The bond0 address is not used in the license files after all. It is the eth0 address that is mentioned in the license file. So I would have to change that.

fritut08 avatar Sep 28 '20 07:09 fritut08

I think I am getting the same issue with Gurobi in WSL2, the licence does not work after reboot due to HostID mismatch. Gurobi-recommended solution is to switch to WSL1.

BoZenKhaa avatar Jan 11 '21 12:01 BoZenKhaa

@BoZenKhaa Yeah, but the problem is the performance.

ghost avatar Jan 13 '21 04:01 ghost

Sorry, I didn't mean that as solution proposal. I wanted to highlight that this issue is affecting not only Matlab licenses and that there are currently no officially recommended solutions within WSL2.

BoZenKhaa avatar Jan 13 '21 12:01 BoZenKhaa

Ok, I got it.

1. Set the static mac address of the "bond0" field. Do change mac address to the address you are previously applied at the license.
   And this change does not affect your internet connection.
   (In your uploaded picture, there are two mac addresses that the license looks for. One is from eth0/other one is bond0)
   -> sudo ip link set dev bond0 address XX:XX:XX:XX:XX:XX

2. Confirm that is your bond0's mac address fixed.

3. Re-activate your license.

You can do this with the flows I wrote.

No, I do not think the bond0 address is the problem. The bond0 address is not used in the license files after all. It is the eth0 address that is mentioned in the license file. So I would have to change that.

I had the same issue with Matlab but was actually able to resolve it by setting a static bond0 address as per @therealkenc's suggestion in #5866. The installer was indeed echoing both bond0 and eth0 addresses, and the license file was looking for the eth0 one, initially. But I got a new license that is tied to the bond0 address and so far it seems to work fine (after a few reboots).

Here are the steps that worked for me:

  1. Log into the MathWorks license center
  2. Select license
  3. Go to "install and activate" tab
  4. Go to "activate to retrieve license file" (under "related tasks")
  5. Click on the "activate a computer" button
  6. Use the static bond0 address as the host ID
  7. Download the license file and replace the old one

I hope this helps, at least specifically for Matlab.

Many thanks to @minmossi, @mauver15, and @therealkenc for their comments and solution! This was a very annoying issue.

ailiop avatar Jan 14 '21 13:01 ailiop

the license file was looking for the eth0 one

Why does a program check license status with MAC address of a network interface? That's the most horrible software. 😨

Biswa96 avatar Jan 14 '21 13:01 Biswa96

@Biswa96 Actually, many programs do like Xilinx Vivado, although I think it's certainly a horrible decision too.

ghost avatar Jan 16 '21 14:01 ghost

@ailiop It's so sad that Xilinx Vivado doesn't even let me change the interface name for checking license. :(

ghost avatar Jan 16 '21 14:01 ghost

I have another vendor that relies on the MAC for licensing and just got bit by this. As a result, this issue has just made WSL2 useless for our needs. I hope this issues is getting some attention and a patch is forthcoming?

Also, if it's possible to modify this issue's title, can it be changed to something like "WSL 2 - MAC address changes every time network interface is started"?

Seairth avatar Jan 30 '21 15:01 Seairth