Windows 10 Anniversary Update includes Windows Subsystem for Linux (WSL) and you can open a Bash shell like the traditional Command Prompt and use the original command line tools from Ubuntu Linux. However, instead of using WSL, you can also install and use a full version of Ubuntu Linux on a virtual machine such as VirtualBox, VMWare or Hyper-V.
Running a virtual machine requires more system resources (CPU, memory and etc.), but you don’t have to worry about compatibilities or availabilities of command line tools. All tools including GUI based ones and servers are readily available as you’re actually running a full version of the OS in a separate virtual device. When you want to move your virtual machine to a different server or move the settings to a real server, the changes you need to make for your workflow is also minimal since your workflow is already setup for an isolated and independent virtual device.
In order to improve the security, you can setup the network for your virtual machine to accept connections only from the same PC where the virtual machine is running. Such configuration is commonly referred to as “Internal Network” or “Host-only Networking” and it hides and protects the virtual machine from the outside world.
However, such network configuration seems to cause a connection problem for Windows Store apps. When you try to make a connection from Token2Shell/MD or Microsoft Edge browser, you may end up getting a timeout error message (https://www.virtualbox.org/ticket/15565).
It seems the problem is related to the secure app container that Windows Store apps are running from. For some virtual machine software (ex. Hyper-V), adding the app to Windows loopback exempt list or enabling app’s loopback option (Microsoft Edge browser » about:flags) is enough to gain access for the virtual machine. But, for other software (ex. VirtualBox), you may need to use additional workarounds. The simplest workaround we found is using the Windows built-in command “
netsh” and creating a network traffic proxy socket.
For example, if your virtual machine has a network address of “192.168.56.101” and you want to connect to its SSH server at port number 22, use the following
netsh command line (the command must be run as an administrator):
netsh interface portproxy add v4tov4 listenaddress=localhost listenport=22 connectaddress=192.168.56.101 connectport=22 protocol=tcp
Once the command is completed, you can connect to “localhost” at the port number 22 for your virtual machine. If you already have a server running at port number 22 or wish to use a different port number on “localhost“, you need to change the “listenport” option which can be any number from 1 to 65535 (but should be higher than 1024).
Please note that the entry added via
netsh isn’t removed even after system rebooting. You must explicitly remove it using the “delete” command in
netsh interface portproxy delete v4tov4 listenaddress=localhost listenport=22
For displaying the currently active “portproxy” settings, you can use the “show” command.
netsh interface portproxy show all