dantmnf / WSLAttachSwitch

Attach the WSL2 virtual machine to a Hyper-V virtual switch.
The Unlicense
107 stars 12 forks source link

Create network adapter with the promiscuous mode on #11

Open forrest79 opened 5 months ago

forrest79 commented 5 months ago

Hi, first, let me thank you for this great tool. Only with this, I'm able to solve my personal needs - running multiple LXC containers accessible from the Windows host each on a separate IP address.

I have one question - do you think, is it possible to set the created network adapter to the promiscuous mode? Something like "Enable MAC address spoofing" in Hyper-V virtual machine - Network adapter - Advanced features.

With this, I should be able to run many LXC containers just with one network adapter.

I'm not familiar with the Host Compute System API, but I did some googling and find, that HcnCreateEndpoint method has some flags property in the settings parameter and one of the flag is EnableMirroring.

I already tried to add this setting here https://github.com/dantmnf/WSLAttachSwitch/blob/e7dc8050cf8756c1cf27b9ca7c12e02483f54060/Program.cs#L92 like ["Flags"] = "EnableMirroring". But when I compile it and run, I get an error like Invalid JSON string document. And that's where my knowledge ends :-)

Thanks for your help or suggestions.

dantmnf commented 5 months ago

The JSON schema in Microsoft docs has been updated to a totally different version since the initial release of this project. Now we are on the old schema version and it still works (TM) but only God knows how to add that flag to a document in the old schema. (shrug


Have you tried the new mirrored mode?

forrest79 commented 5 months ago

Thank you for a quick answer. I understand :-) Yes, I already tried the mirrored mode with no luck. Maybe I will try it one more time...