Background: I'm trying to install Vivado in my WSL2 instance, but its licensing scheme requires a fixed MAC address.

I'm able to change the MAC address using the following:

sudo ip link set dev eth0 down
sudo ip link set dev eth0 address 00:15:5d:35:ea:15
sudo ip link set dev eth0 up

After this, I can verify that my MAC address has changed, but the network can't see out

ping www.google.com, for example, no longer resolves:

ping: www.google.com: Temporary failure in name resolution

I'm assuming there's some firewall or filtering or something on the windows side, preventing the interface with the new MAC address from seeing the outside world.

Any suggestions?


Solution 1:

By default, Hyper-V virtual switches (that are also used for WSL2) are set to prevent "MAC address spoofing" by the guest VMs, and will only forward frames with the MAC address that was originally assigned in the VM's configuration.

But the FlexNet licensing software is likely to look for other interface names – it seems that in addition to eth0, it will also gather MAC addresses from wlan0, bond0..9, and vmnic0..9. Any one of the found MAC addresses can be used as the "Ethernet hostid" for licensing.

(Also, at least some versions of FlexNet will look for xp0 as the very first option and use it exclusively if found, unlike the other interfaces which are combined into a list, as can be seen from the lmhostid tool.)

So if you need an interface whose MAC address will never change, create a virtual one that looks like Ethernet (Linux offers several types, either a 'dummy' interface or a 'bridge' with no members would work equally well) with one of the listed names:

ip link add vmnic0 type dummy
ip link set vmnic0 addr 00:15:5d:35:ea:15

#ip link add vmnic0 type bridge
#ip link add vmnic0 type bond
#ip tuntap add vmnic0 mode tap

I haven't tested this with Vivado specifically, but it works with other vendors that use FlexNet's generic lmgrd.

(On a physical system or a full VM, it would also be possible to rename eth0 to something else, then create a virtual eth0 in its place, but this might not work with WSL2 due to the way it's architectured.)