microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.43k stars 824 forks source link

Support Bridged Ethernet and as a Kernel loadable module #6902

Open hakiri opened 3 years ago

hakiri commented 3 years ago

Is your feature request related to a problem? Please describe. Currently, running Mininet simulator (http://mininet.org/) for setting up an SDN development environment on WSL 2 becomes impossible.

The requested feature is ta make it possible to enable such an environment in WSL 2, which in turn allows running advanced software switching technology like OpenVSwitch (https://www.openvswitch.org/). This will open up further possibilities to run virtualized technologies such OpenMANO (https://github.com/nfvlabs/openmano) as well as many network orchestration and management tools such as OSM (https://osm.etsi.org/). Specifically, advanced virtualization technologies such SDN/NFV are currently used in the 5G network and beyond. Supporting these features, will open up several opportunities to the research community to enable testing and simulating 5G anf beyond in WSL2 (which is considered near to bare-metal virtualization in terms of performance and scalability). It will open up several opportunities for teachers, students, researchers and labs centers ta make it possible to simulate such big challenges inside their laptops or surface.

Describe the solution you'd like To make it possible to enable Mininet and Openvswitch on WSL 2, the main solution to address these limitations is to compile with a loadable kernel module instead of a built-in module.

Describe alternatives you've considered To make this happen, the current workaround to bypass this problem is to build a new WSL2 kernel with customized features as described in WSL2 + Mininet (https://zhuanlan.zhihu.com/p/138933513):

1) The main thing is to modify Networking Support -> Networking Options -> 802.1d Ethernet Bridging to modularize features, that is, to compile with a loadable kernel module instead of a built-in module. 2) After booting, first install the kernel module (sudo make modules_install), then load the bridge module (sudo modprobe bridge && sudo lsmod). 3) Thereafter, install openvswitch normally using command : sudo apt install openvswitch-switch. Then, The current WSL 2 does not have systemd yet, so you have to use init.d (or you may use one of the workarround to support systemd in WSL2 like described here : https://github.com/arkane-systems/genie or here : https://github.com/hakiri/ubuntu-wsl2-systemd-script. 4) Next, you can install Mininet under Ubuntu by typing: sudo apt install mininet, and test it is working by typing: sudo mn --test pingall 5) If you want to use Mininet-WIFI (https://mininet-wifi.github.io/), which is mininet for wireless communication and IoT (including 6LowPAN), you have to modify the options to support mac80211 and mac80211_hwsim when compiling the kernel (in step 1 above), by doing a) mac80211 in Networking Support -> Wireless -> cfg80211 and mac80211; and b) mac80211_hwsim is in Device Drivers -> Network device support -> Wireless Lan -> Simulated radio testing tool for mac80211.

These steps have been tested successfully for WSL 4.19; but have several running issues when compiling WSL2-Linux-Kernel 5.4 and 5.10. Additional context Below are the workaround to make this feature possible:

image

therealkenc commented 3 years ago

that is, to compile with a loadable kernel module instead of a built-in module.that is, to compile with a loadable kernel module instead of a built-in module.

CONFIG_BRIDGE (plus CONFIG_BRIDGE_NETFILTER= and CONFIG_BRIDGE_VLAN_FILTERING) are compiled =y by design.

From your screencaps, it looks like the asks are:

CONFIG_MAC80211
CONFIG_MAC80211_HWSIM
CONFIG_MAC80211_MESH
CONFIG_CFG80211
CONFIG_OPENVSWITCH

If I missed any (I might have) please list the kconfig options you'd like.

hakiri commented 3 years ago

@therealkenc Correct, the config files I used are changed from =y to =M. My post is not an issue, but a suggestion to support such features in the future.

the post is to suggest supporting CONFIG_BRIDGE=M and in general to provide (why not make it possible in future releases) support for advanced switching capabilities like openvswitch. Currently, multipass (an alternative to WSL2 from ubuntu canonical) is a type hypervisor that can run atop of VirtualBox and hyper-v supports such features (but still type 2 hypervisor)