Open notusedanymore2 opened 4 years ago
Was able to repro here.
sudo ip route add default via (windows_side_ipconfig_vEthernet_ip) dev eth0
doesn't help.
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.
if there was a way to modify the adapter properties from the Windows side
HcnCreateNetwork -> HcnCreateEndpoint -> HcsModifyComputeSystem
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.
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.
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.
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.
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.
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".
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".
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.
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 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 Yeah, but the problem is the performance.
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.
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:
bond0
address as the host IDI 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.
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 Actually, many programs do like Xilinx Vivado, although I think it's certainly a horrible decision too.
@ailiop It's so sad that Xilinx Vivado doesn't even let me change the interface name for checking license. :(
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"?
Anyone know of any updates on this topic?
I'm experiencing the same issue mentioned in the OP, which this thread has since strayed from a little. Regardless of the reason for doing it, changing the MAC address for my eth0
device causes "temporary failure in name resolution" errors; resetting it back to the original then produces "network is unreachable" errors instead. I have two different WSL distros installed - Ubuntu 20.04 and Kali 2021.1 - and changing the MAC from kali (via macchanger -rb eth0
and later macchanger -p eth0
) causes these errors in both distros. I've had to completely shut down and restart WSL (wsl --shutdown
) in order to get it working again.
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"?
The original issue is about network connection breakage whenever the MAC is changed, not about the address changing when the interface is started.
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".
Ok, I got it.
- 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
- Confirm that is your bond0's mac address fixed.
- Re-activate your license.
You can do this with the flows I wrote.
This worked for me. I didn't need to reactivate my license, I just set my bon0 to the Host ID from my activated license and matlab started right up from the command line.
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.
I switch to WSL1 but this problem still exists. For WSL1, the hostid still changed after rebooting
It is possible to add new virtual network interface with a new MAC address using this workaround https://github.com/microsoft/WSL/discussions/7395. But it taps into some undocumented and dangerous APIs.
I used the intelFPGA suites and it seems that it checks only eth0 and i can't change this. So i need to put a fixed MAC ADRESS to eth0 ...
For software that only checks eth0
, I'm using a workaround involving changing the bond0
interface name to eth0
. For example, something like this in .bashrc
:
mac=7b:6c:2a:30:2b:08
gateway=$(ip route | awk '/default via /{print $3; exit}' 2>/dev/null)
if ! ip link show | grep -q $mac; then
sudo ip link set dev eth0 down
sudo ip link set dev eth0 name eth1
sudo ip link set dev eth1 up
sudo ip route add default via $gateway dev eth1
sudo ip link set dev bond0 down
sudo ip link set dev bond0 address $mac
sudo ip link set dev bond0 name eth0
sudo ip link set dev eth0 up
fi
The old eth0
is renamed to eth1
but all connections still appear to work after the rename.
I am in the same situation as @tanguy-e . Questa does not detect a license, even when I use the script you have. here is my IP setting now:
ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,MASTER,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
4: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet xxx.xxx.xxx.xxx/20 brd xxx.xxx.xxx.xxx scope global eth1
valid_lft forever preferred_lft forever
inet6 xx:xx:xx:xx:xx::xx/64 scope link
valid_lft forever preferred_lft forever
5: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
link/ipip 0.0.0.0 brd 0.0.0.0
6: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
I note that eth0
still shows the state is DOWN
, even after explicitly running the command sudo ip link set dev eth0 up
.
For software that only checks
eth0
, I'm using a workaround involving changing thebond0
interface name toeth0
. For example, something like this in.bashrc
:mac=7b:6c:2a:30:2b:08 gateway=$(ip route | awk '/default via /{print $3; exit}' 2>/dev/null) if ! ip link show | grep -q $mac; then sudo ip link set dev eth0 down sudo ip link set dev eth0 name eth1 sudo ip link set dev eth1 up sudo ip route add default via $gateway dev eth1 sudo ip link set dev bond0 down sudo ip link set dev bond0 address $mac sudo ip link set dev bond0 name eth0 sudo ip link set dev eth0 up fi
The old
eth0
is renamed toeth1
but all connections still appear to work after the rename.
Thanks @darchons this works perfect. To change my MAC address automatically on WSL startup:
I put your snippet in a bash file "wsl.mac
" that I put in /etc/ and that I made executable.
Then I created wsl.conf
in /etc/ with the following content:
[boot]
command = sudo /etc/wsl.mac
For software that only checks
eth0
, I'm using a workaround involving changing thebond0
interface name toeth0
. For example, something like this in.bashrc
:mac=7b:6c:2a:30:2b:08 gateway=$(ip route | awk '/default via /{print $3; exit}' 2>/dev/null) if ! ip link show | grep -q $mac; then sudo ip link set dev eth0 down sudo ip link set dev eth0 name eth1 sudo ip link set dev eth1 up sudo ip route add default via $gateway dev eth1 sudo ip link set dev bond0 down sudo ip link set dev bond0 address $mac sudo ip link set dev bond0 name eth0 sudo ip link set dev eth0 up fi
The old
eth0
is renamed toeth1
but all connections still appear to work after the rename.
When I try this approach, I got the following errors
Cannot find device "bond0"
Cannot find device "bond0"
Cannot find device "bond0"
Cannot find device "eth1"
any idea?
Apparently, bond0
and other network devices are not created by default since WSL 1.17, which was released last week. See also #7791.
You can create bond0
manually:
sudo ip link add bond0 type bond
For me, this was sufficient for then setting its MAC address as per https://github.com/microsoft/WSL/issues/5866#issuecomment-697183065. I suspect the same will be true for cloning eth0
into eth1
, etc.
The line
sudo ip link set dev bond0 name eth1
is not working and need to be somehow modified
Ran into the same problem, I needed static MAC addresses for network authentication, so I modified WSLAttachSwitch to add the ability to add NICs with static MAC addresses: you can get my modified version here, if the author hasn't merged it yet
sudo ip link add bond0 type bond
Not sure why, after upgrade windows recently, I can not change the mac address, ip link set eth0 addr XXXXXXXXXXXXX RTNETLINK answers: Cannot assign requested address
Ran into the same problem, I needed static MAC addresses for network authentication, so I modified WSLAttachSwitch to add the ability to add NICs with static MAC addresses: you can get my modified version here, if the author hasn't merged it yet遇到了同样的问题,我需要静态MAC地址进行网络身份验证,因此我修改了WSLAttachSwitch以添加具有静态MAC地址的NIC的功能:如果作者尚未合并,则可以在此处获取我的修改版本。
大佬,我想问问这个方案还能用吗,我尝试了一下显示“The application to execute does not exist: 'D:**\WSLAttachSwitch.dll'.”,我搜索了一下都没有找到这个文件
Ran into the same problem, I needed static MAC addresses for network authentication, so I modified WSLAttachSwitch to add the ability to add NICs with static MAC addresses: you can get my modified version here, if the author hasn't merged it yet遇到了同样的问题,我需要静态MAC地址进行网络身份验证,因此我修改了WSLAttachSwitch以添加具有静态MAC地址的NIC的功能:如果作者尚未合并,则可以在此处获取我的修改版本。
大佬,我想问问这个方案还能用吗,我尝试了一下显示“The application to execute does not exist: 'D:**\WSLAttachSwitch.dll'.”,我搜索了一下都没有找到这个文件
作者已经合并此PR,请使用作者的版本。另外我没遇到这种问题 for non Chinese speakers: The author has merged this PR, please use the original version. Besides, I have not encountered this problem
Hi. Can you please collect networking logs by following the instructions below? https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues
I want to add my solution to the already presented bulk as well. Since my original comments (https://github.com/microsoft/WSL/issues/5352#issuecomment-678108088) four years ago, a few things changed but this problem still persists. I have since switched machines and reinstalled WSL and MATLAB a few times. Currently, the WSL only has two network devices by default:
ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
...
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1492 qdisc mq state UP group default qlen 1000
link/ether SOME:MAC:ADDRESS brd ff:ff:ff:ff:ff:ff
...
When MATLAB is registered in this situation, the license will include the mac address of eth0
. After restarting the machine, the mac address of eth0
changes and MATLAB will complain since it cannot find any device whose mac address matches the one in the license.
Therefore, I simply create an additional network device with the mac address in the license with this command:
sudo ip link add bond0 address SOME:MAC:ADDRESS type bond
Afterwards, MATLAB can be started without license errors.
Unfortunately, this device is lost when the machine is shut down. Therefore, instead of executing the command above after every restart, one can let this command automatically be executed every time WSL is started by adding this to the file /etc/wsl.conf
within the WSL:
[boot]
command = ip link add bond0 address 00:15:5d:e1:cf:3f type bond
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. 😨
It's really common in specified domain softwares who use FLEXlm to manage license. One MAC, one license, and one bill
Environment
Steps to reproduce
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.