EBC Exercise 02 Setting Up Windows Subsystem for Linux

From eLinux.org
Revision as of 14:38, 10 September 2020 by Yoder (talk | contribs) (Sharing the network)
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder


The Beagle can run standalone with a monitor and keyboard and mouse, but we use it in an iot mode where it's accessed through the network. When used this way an Linux host is used that is either a native install on a laptop (or desktop) or a virtual machine running under Windows.

The purpose of this wiki is to introduce a third option, running in the Windows Subsystem of Linux (wsl).

The Windows Subsystem of Linux

wsl lets developers run a GNU/Linux environment directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup. Details about wsl can be found here: https://docs.microsoft.com/en-us/windows/wsl/about, or just googling for it. Here I'll highlight how to install and use is for the class.

Installing WSL

Simply got to the Microsoft Store and search for ubuntu. Select the newest one and follow the directions. If you want wsl 2, go to: https://docs.microsoft.com/en-us/windows/wsl/install-win10.

Sharing the network

We used ip masquerading to have the host computer share the network with the Beagle. Here you need to set up Windows to do the sharing.

Once the Beagle is connected to your host computer running Windows 10, there should be an "ethernet connection" created over usb.

To share your internet from Windows:

  • Right click the wifi or ethernet icon in your taskbar, and select the Open Network & Internet Settings option.
  • Once the window is opened, scroll to the bottom and press Change adapter options under Advanced network settings.
  • To share your internet, right click on the adapter that your host is using to access the internet, and select Properties.
  • Go to the sharing tab at the top, and check the Allow other network users to connect through this computer's Internet connection option. If you have multiple internet adapters, you might need to select the Bone using the drop down menu. It should be the adapter with the description Remote NDIS Compatible Device in the Network Connection window.
  • Press OK at the bottom, then
  • right click the adapter for the Bone (the one labled Remote NDIS Compatible Device), and press Properties.
  • Double click on the Internet Protocol Version 4 option on the main tab, and
  • set both the IP address and DNS server addresses to be set automatically.
  • Press OK to go back to the Properties window and
  • press OK again.

After that, ssh into the bone, and run the command

bone$ sudo route add default gw 192.168.7.1

(This command needs to be run every time you boot the Bone.) The Bone should now have access to the internet. If you disconnect the Bone from your host, you may have to stop sharing your internet and reshare it, then set the IP and DNS Addresses to be automatic again for it to work.

thumb‎ Embedded Linux Class by Mark A. Yoder