You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Start a distro with fixed MAC address on WSL2 #5291
Is your feature request related to a problem? Please describe.
The MAC address of distro changes every time it is started.. Some software license is based on MAC address. Changes will make license unusable.
Describe the solution you'd like
I wish we can have similar option like wsl -d distro --mac xxx.xxx
Since I just stumbled on this issue, I'd like to point everyone to the fact that macAddress was added as a hidden (undocumented) option in .wslconfig and is available to current stable WSL2 1.0+.
But due to setting relying on additional setup and OS requirements, putting just config snippet here isn't telling whole story.
Anyway, yes that's the setting, you just need Hyper-V vSwitch, that requires Hyper-V, that requires Win 11 Pro, and several setup/config steps before and after setting this in wslconfig.
Thus for full story read guide linked in my comment above, so I don't need to copy paste the whole workflow in every issue thread these settings solve.
Btw do not fear, if you have W11 Pro with Hyper-V, getting WSL2 to proper networking is 5-10min setup.
Activity
therealkenc commentedon May 30, 2020
Suggestion was brought up in passing in #4210 (message). Probably would be a
.wslconfigthing. The adapter is shared between distros. Ref also #4454.luxzg commentedon Nov 24, 2022
Since I just stumbled on this issue, I'd like to point everyone to the fact that
macAddresswas added as a hidden (undocumented) option in .wslconfig and is available to current stable WSL2 1.0+.The discovery was mentioned in issue 4150 and I've tried to document it with other new options the best I could here:
https://github.com/luxzg/WSL2-fixes
Hope this information helps someone!
emoxam commentedon Dec 16, 2022
Well it may be something like that in %UserProfile%/.wslconfig
[wsl2]
networkingMode = bridged
vmSwitch = Ext
macAddress=5c:bb:f6:9e:ee:55
luxzg commentedon Dec 21, 2022
Exactly, as I said above.
But due to setting relying on additional setup and OS requirements, putting just config snippet here isn't telling whole story.
Anyway, yes that's the setting, you just need Hyper-V vSwitch, that requires Hyper-V, that requires Win 11 Pro, and several setup/config steps before and after setting this in wslconfig.
Thus for full story read guide linked in my comment above, so I don't need to copy paste the whole workflow in every issue thread these settings solve.
Btw do not fear, if you have W11 Pro with Hyper-V, getting WSL2 to proper networking is 5-10min setup.
micheldiemer commentedon Apr 18, 2024
Here a detailed working procedure on how to use WSLAttachSwitch
Script : #4799 (comment)
Text : #4799 (comment)