INGREDIENTS

X410 supports traditional methods such as SSH X11 forwarding and direct TCP/IP networking for accepting connections from Linux GUI apps running in virtual machines. So, if you already have a Linux virtual machine in Hyper-V, you can seamlessly use its GUI apps alongside with Windows apps via X410.

However, when using SSH X11 forwarding, you're adding unnecessary overhead of encrypting communication data, not to mention the extra workload and resources required for maintaining the SSH connections themselves. If you use the direct TCP/IP networking, you can avoid the encryption and other overheads, but since you need to allow public access for Windows host, there can be security issues. Without this public access, Linux GUI apps in your virtual machine cannot connect back to X410 running in Windows host. You may also have connection restoring problems after waking up from sleep mode; connections made from Linux GUI apps to X410 get severed after waking up, but the Linux GUI apps think those connections are still alive and active.

X410 also supports communicating with Hyper-V virtual machines via VSOCK (virtual socket). VSOCK doesn't rely on TCP/IP networking and it's only used for communicating between Windows host and virtual machines running within that host. Hence you don't need to make any change to firewall or security related settings in Windows; no public access required! You can also avoid other overheads and issues such as the encryption and the sleep mode problem mentioned above.

The following shows quick steps for test driving the VSOCK with X410. If you want to fully replace your Linux GUI desktop on Hyper-V console with X410, additional information is found in "Using X410 with Hyper-V Linux Virtual Machines via VSOCK".

X410 + VSOCK

PROSCONS
  • Less workload for virtual machines; no need to run X-Window or XRDP server within a virtual machine
  • Seamlessly share clipboard with Windows apps
  • No need to change any firewall or security setting
  • Avoid TCP/IP network restoration problems after waking up from sleep mode
  • Need to add entries in Windows registry for mapping VSOCK ports
  • Need a data relay server running in virtual machines

Windows 10

X410 runs in a secure sandbox and it cannot directly modify Windows registry. Hence you need to manually make the changes in Windows registry as described below.

In order to have X410 communicate with Hyper-V virtual machines via VSOCK, you first need to add a Windows registry key under 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\GuestCommunicationServices'. The new registry key must be in the following format:

<portnumber>-facb-11e6-bd58-64006a7986d3



<portnumber> is derived from the display number set for X410. If it's set to be '0', <portnumber> must be '6000 + 0 (= display number)' in 4-byte hexadecimal format; 00001770. Hence the new registry key becomes '00001770-facb-11e6-bd58-64006a7986d3'. For the display number 1, it becomes '00001771-facb-11e6-bd58-64006a7986d3' and so forth.

Under the new registry key, you also need to add the following string value for a friendly name that describes what the key is used for:

"ElementName"="X410 Display 0"







Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\GuestCommunicationServices\00001770-facb-11e6-bd58-64006a7986d3]
"ElementName"="X410 Display 0"




You can also download one of the following registry files for adding the entries mentioned above. You can import it from 'Registry Editor (regedit.exe)' in Windows.

DONE

In order to enable the VSOCK feature in X410, you need to launch X410 with a command line switch '/listen hyperv'. You can use command-line switches directly from Windows Start menu, Windows Command Prompt or PowerShell.

x410 /listen hyperv /wm








When the Hyper-V (VSOCK) option is properly enabled, X410 adds a '+hyperv' text label to its tray icon tooltip.

DONE

Hyper-V Linux Virtual Machine

We're assuming you already have a Hyper-V Linux virtual machine. If you don't have one, try the quick method that was newly added in Windows 10 Fall Creators Update (Windows 10 version 1709); 'Hyper-V Quick Create'.

In this guide, we're showing command-line examples for Ubuntu. However, you shouldn't have any problem applying the same procedure for other Linux distributions; you just might need to adjust the commands for installing programs (ex. 'sudo pacman -S socat' for installing socat in Arch Linux).

In order for our VSOCK method to work, you need to make sure 'hv_sock' Linux module is installed on your virtual machine. For checking the installed modules, you can use 'lsmod' command.

If you cannot find 'hv_sock', you should be able to install it by using the following commands.

sudo sh -c 'echo "hv_sock" > /etc/modules-load.d/hv_sock.conf'
sudo reboot



Please also check the version of your Linux and make sure its version is 4.14 or higher. Hyper-V (hv_sock) is supported since Linux 4.14.

DONE

Although X410 can be directly connected via VSOCK from Hyper-V Linux virtual machines, X-Window apps and tools are not built for VSOCK; we need an intermediate data relay server that can be seen as an X-Window server for those programs.

In this example, we're using a popular utility program called 'socat'. socat is used in order to simply demonstrate the possibility of using VSOCK; it's definitely not used for its performance.

sudo apt update && sudo apt install socat



You can then execute the following command to create a virtual X-Window server that forwards data to and from X410.

socat -b65536 UNIX-LISTEN:/tmp/.X11-unix/X5,fork,mode=777 SOCKET-CONNECT:40:0:x0000x70170000x02000000x00000000 &



Please note that the above command creates a server at display number '5'. So you should set the DISPLAY environment variable as the following in order to have X-Window apps use this server:

export DISPLAY=:5.0



Please also note that we're using a display number '5' instead of '0'. It can be any number, but '0' is already used by the Linux GUI desktop running on Hyper-V console. Before assigning a display number, check '/tmp/.X11-unix/' folder and just make sure your display number is not already in use (X<display-number>; X0, X10 and etc.).

DONE

You're now ready to start Linux GUI apps and open them on Windows via X410. Please note that instead of using the 'export' command shown above, you should also be able to use a command-line switch for most Linux GUI apps (ex. firefox --display :5.0).

Please also note that some Linux GUI apps have a main hidden background program that manages its visible instances (ex. GNOME Terminal, FireFox and etc.). For such programs, you may not be able to start a new instance for a display number that is different from its first instance. For example, when you already have a FireFox opened on your Hyper-V console, you cannot open another FireFox on Windows via X410; you first need to close the FireFox on Hyper-V console.

DONE

Share This Story, Choose Your Platform!