Skip to content

Start a distro with fixed MAC address on WSL2 #5291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
honeway opened this issue May 29, 2020 · 5 comments
Open

Start a distro with fixed MAC address on WSL2 #5291

honeway opened this issue May 29, 2020 · 5 comments
Labels

Comments

@honeway
Copy link

honeway commented May 29, 2020

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

@therealkenc
Copy link

Suggestion was brought up in passing in #4210 (message). Probably would be a .wslconfig thing. The adapter is shared between distros. Ref also #4454.

@luxzg
Copy link

luxzg commented Nov 24, 2022

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+.

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
Copy link

emoxam commented 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
Copy link

luxzg commented 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
Copy link

Here a detailed working procedure on how to use WSLAttachSwitch

Script : #4799 (comment)

Text : #4799 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants