Home Audience Expert Users Deploy Synergy to Share Your Devices

Deploy Synergy to Share Your Devices

0
258

Cloud connection visul

This article discusses a program called Synergy, which is used for sharing the mouse and keyboard of server with number of clients. By definition, the word ‘synergy’ implies that the whole is greater than the sum of its parts. This awesome software program clearly demonstrates this!

Do you have two or more computers at your desk? And how do you operate them? Like everyone else, by using the keyboard and mouse of each computer, right? Wouldn’t it be great if you could use just a single keyboard and mouse to operate multiple computers? Well, you can do that with Synergy. So let’s go ahead and explore this software’s configuration and some of its troubleshooting techniques.
For demonstration purposes, I’ll use Windows 7 and Ubuntu GNU/Linux. Figure 1 depicts the details of my set-up.

Figure 1
Figure 1 : Synergy diagram

In my set-up, both the systems are laptops but any combination of desktop/laptop is fine. An external keyboard and mouse are connected to the Ubuntu machine. And with the help of Synergy, they will be used to operate both these machines. It doesn’t matter whether the keyboard or mouse are connected via PS2, USB or wireless; whether the architecture is x86 or x64; or if the systems are connected using a wired or wireless network. As long as both systems are reachable over the network, Synergy will do its job. So let us get our hands dirty with it.

An introduction to Synergy
Synergy is a software application that allows you to share a keyboard and a mouse between multiple systems. It is somewhat similar to the KVM (Keyboard, Video and Mouse) switch but is purely a software entity. It is convenient when a single user wants to operate multiple systems, and is also useful in situations in which several systems are connected to a monitor and the user wants to operate them using a single keyboard and mouse.

Synergy follows the client-server model, in which there is a single server and one or more clients. The server is the system to which the keyboard and mouse are physically connected. In my case, it is the Ubuntu machine. To operate another system, just move your mouse pointer to the other system’s screen. Theoretically, there is no limit to the number of clients that can be connected. Isn’t it an awesome concept?
Synergy supports all major platforms and works fine with MS Windows, GNU/Linux and Mac OS X, allowing the user to seamlessly move the mouse cursor between multiple sessions. The operating system requirements for Synergy are given below:

  • MS Windows: Windows XP3 onwards
  • Ubuntu: Ubuntu 10.04 onwards
  • Mac OS X: Mac OS 10.5 onwards

But if we can also share the keyboard and mouse by using a KVM switch, then what is special about Synergy? Well, KVM is hardware; hence, you have to purchase it, which adds to costs and also occupies some space on your desk. On the other hand, Synergy is purely a software component. Hence, it doesn’t occupy space on your desk. Some of the salient features of Synergy are listed below:
1) It is a lightweight application with a very low footprint.
2) It is open source and entirely free of cost. As its source code is available to the public, you can customise it according to your requirements.
3) It is cross-platform and works fine with all major OS platforms.
4) It has full encryption support, which keeps sensitive data safe on public networks.
5) One of the great features of Synergy is that it shares the clipboard between Synergy sessions.
6) It allows one to move the mouse seamlessly between Synergy sessions.
7) It doesn’t require any special hardware. Only network connectivity is required.
8) It doesn’t require a high-speed network and works seamlessly with regular network bandwidth.

Installation steps
Now that we are familiar with the use cases of Synergy, let us quickly go through the installation steps. The section below describes the installation procedure on Ubuntu GNU/Linux and MS Windows. For any other option, refer to the installation guide of the OS you’re interested in.
Synergy is available in Ubuntu’s official software repository. You can install it by using the following command:

[bash]$ sudo apt-get update

[bash]$ sudo apt-get install synergy

In addition, you can install a pre-compiled .deb package. To download the latest version of Synergy, visit its official website http://synergy-project.org/ and download the appropriate version. The steps below describe the installation of the .deb package on Ubuntu using the dpkg package manger.

[bash]$ ls
synergy-1.5.1-r2398-Linux-x86_64.deb
[bash]$ sudo dpkg -i synergy-1.5.1-r2398-Linux-x86_64.deb

For MS Windows, download the pre-compiled installer from the same location. Double click on the installer and follow the on-screen installation instructions.
Note: Please ensure that versions of both the Synergy applications are the same.

Configuration steps
It takes only a few minutes to configure Synergy. Configuration is required only at the Synergy server (hereafter referred to as just the server) side, and Synergy clients (hereafter called clients) can directly connect to it.
First, choose a server. Obviously, we will choose Ubuntu as the server because the external keyboard and mouse are connected to it. We can configure the server either by creating a configuration file or by using a GUI tool. This section describes both methods.
The server machine shares its keyboard and mouse with clients. It needs to know about all the clients that will connect to it. So, to inform the server about these clients, create a configuration file. Synergy’s configuration file is a plain text file with two mandatory sections and one optional section. The configuration file for our set-up will look like this:

[bash]$ cat ~/synergy.conf
section: screens
ubuntu:
windowspc:
end

section: aliases
windowspc:
xxx.xxx.xxx.xxx # Replace it with actual IP of Windows machine
end

section: links
ubuntu:
left = windowspc
windowspc:
right = ubuntu
end

In the above configuration, ‘screens’ and ‘links’ are mandatory and ‘aliases’ are optional. The default syntax of any section is as follows:

section: name
arguments
end

Section names can be ‘links’, ‘screens’, ‘aliases’ or ‘options’. Let us first understand the configuration file.
The first section is ‘screens’, which simply lists the names of the systems participating in the Synergy session. In our case, there are two systems and, hence, there are two entries. In this section, you can either use the hostname or IP address of the system.
The next section is ‘aliases’. Synergy clients provide the hostname while establishing a connection with the server, so the server can find them in the configuration. Some systems report FQDN (Fully Qualified Domain Names) and some report only hostnames, depending on their network configuration. This section provides a list of names by which each computer is known. To describe this section, we can either use the IP address or the FQDN of the system. If you are using the FQDN in the ‘screens’ and ‘links’ section, then this section is optional.
Our last section is ‘links’. This describes the virtual adjacency of the systems. If you remember, in the configuration, the Windows 7 machine is to the left of the Ubuntu machine or, you could say that the Ubuntu machine is on the right side of the Windows 7 machine. The ‘links’ section depicts this information. To know more about Synergy’s configuration options, go through the details on http://synergy2.sourceforge.net/configuration.html.
Now let us test this configuration. On the Ubuntu machine, start the server in the foreground by using the following commands:

[bash]$ synergys --config ~/synergy.conf --no-daemon --no-restart
INFO: Synergy 1.5.1 Server on Linux 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64
NOTE: started server, waiting for clients

Our server has started successfully and is waiting for the client connection. Here the ‘–no-restart’ option implies: “Do not try to restart the server upon failure.” Now switch to the client, i.e., Windows 7, and execute the following commands in the terminal:

[Windows CMD]$ cd “C:\Program Files\Synergy”

[Windows CMD]$ synergyc.exe --no-daemon --no-restart “xxx.xxx.xxx.xxx”
INFO: Synergy 1.5.1 Client on Microsoft Windows 7 x86
NOTE: started client
NOTE: connecting to ‘xxx.xxx.xxx.xxx’: xxx.xxx.xxx.xxx:24800
NOTE: connected to server
INFO: entering screen
INFO: leaving screen

Congratulate yourself; the connection has been established successfully. You should now be able to move the mouse between synergy sessions.

Note: For security reasons in the article, I have used ‘x.x.x.x.’ Do replace this with the actual IP address of your server machine.

One of the advantages of the text configuration is that we can copy it to another machine, and Synergy can be started by doing just a little modification. But some people prefer the GUI tool instead. No problem! Synergy also has an intuitive GUI tool from which you can configure the server, and there is also a GUI client. The section below illustrates the steps to configure the server using the GUI tool.
1) On the Ubuntu machine, first launch the Synergy application from Unity dash. The first two screens don’t require any special attention.
2) Select the server option from the third screen.
3) Optionally, you can enable the encryption feature for Synergy. After that, click the ‘Finish’ button.
4) From the main screen, ensure that the ‘Configure Interactively’ radio button is selected. Then click on the ‘Configure Server’ button.
5) To add a new client, drag a new screen onto the grid from the spare ones at the upper right. By default, the name of the screen is shown as ‘Unnamed’. To rename it, double click on it and give it an appropriate name. In my case, the name is ‘windowspc’. Optionally, we can also define aliases on this screen.
5) Similarly, to remove a client, drag the screen to the trash icon present in the upper left.

Figure 2
Figure 2 : Server configuration

Figure 2 shows what our configuration screen will look like.
To activate the configuration, click the ‘OK’ button and start the server. That’s it! We have started the server successfully. Now let us switch to the client. The section below describes the steps to be performed on the client.
1) First, launch the Synergy application.
2) Select the ‘Client’ check-box, enter the IP address of the Synergy server in the ‘Server IP’ text-box and click on the ‘Start’ button.
After establishing the connection, the screen will look like what’s shown in Figure 3.

Figure 3
Figure 3 : Client

Auto-launching Synergy
Synergy is an awesome utility. By default, we have to launch it explicitly, every time. Wouldn’t it be great if Synergy starts automatically when you log in to the system? We can do this too. In this section, we are going to explore auto-launching the Synergy server after logging into a GNOME session.
We can also launch the Synergy GUI application from the command prompt. Just type synergy at the command prompt and that’s it. To auto-start Synergy, go to Unity Dash -> Startup Application Preference -> Click on Add button. This will result in a pop-up message window. In place of the command, type ‘absolute path of Synergy’. In my case, it is /usr/bin/synergy. Click the Add button to save the configuration.
If you want to use the configuration set-up with ‘synergys’, use the following instead:

synergys --config ~/synergy.conf

To auto-launch the client on Windows, go through the MS Windows documentation.
Tips and tricks
Now that we are familiar with Synergy, let us discuss a few tips and tricks that will make our lives easier.
1) If we use a static IP for the Synergy server instead of DHCP, we can configure both the Synergy client and the server to auto-start and also establish a connection whenever we log in to a session. This is a one-time procedure; once you have automated this process, you don’t have to do anything.
2) Using Synergy, we can seamlessly move the cursor from one monitor to another, but sometimes we may want to restrict the cursor to only one monitor—for instance, while playing video games. To achieve this, press the ‘Scroll Lock’ key, which will restrict the cursor to the present screen. Users who don’t have a ‘Scroll Lock’ key can re-assign the Scroll Lock key by clicking ‘Con?gure Server’ and selecting the ‘Hotkeys’ tab.
3) Synergy shares the clipboard between its sessions. For instance, in our case we can copy text from Windows 7 and paste it in Ubuntu and vice-versa. Additionally, we can also drag and drop files between two MS Windows sessions. This feature is available only with the premium edition. To know more details about this, go through Synergy’s official website.
4) While copying text between multiple sessions, Synergy automatically translates linefeeds between UNIX and Windows formats, enabling cutting and pasting across systems as easily as within a single one. In addition, it forces screensavers to activate and deactivate, in concert.
Troubleshooting
Sometimes, because of invalid user configuration or software bugs, strange problems do occur. In this section, we are going to discuss a few common issues and how to work around them without spending too much time.
1) Both the Synergy client and servers show that they are in a connected state, but the mouse doesn’t appear on the second screen.
Check whether the ‘Scroll Lock’ key is activated or not. As stated earlier, the ‘Scroll Lock’ key restricts the cursor to the current screen. This is the default behaviour of Synergy.
2) Why does the Synergy server refuse to accept a connection to the client?
This problem may occur because of multiple reasons. First, it can be because of a strict firewall rule. By default, Synergy runs on port number 24800. Check whether a firewall rule is added for that port or not. Additionally, with the ‘-a’ option, we can run it on any other available port.
This issue can also occur because of different client and server versions. Please ensure that both client and server are of the same version. Also, double check the ‘aliases’ settings.
3) Certain programs stop me from moving the mouse off screen.
This usually occurs in Windows Vista and later versions, and is due to UAC in Windows. We can get rid of this problem by running Synergy in an ‘Elevated’ mode. This option is available at the bottom of the main Synergy window.
4) Why is the mouse over sensitive during games on the client?
To solve this issue, we first need to enable the relative mouse movements on the server. Please follow the steps given below to do so.

  • Click on the ‘Configure Server’ button.
  • Then click on the ‘Advanced server settings’ tab.
  • Tick the ‘Use relative mouse moves’ check-box and press the ‘OK’ button.

In addition to this, you can try to lock the mouse to your client screen by pressing the ‘Scroll Lock’ key.
5) How do I send a debug output to the developers?
If Synergy is not working as expected and you want help from the community, then provide some debug logs while describing the problem. That makes troubleshooting really easy. Please follow the steps below to capture and send debug logs.

  • Click on the ‘Edit’ menu and select ‘Settings’.
  • Change the ‘Logging level’ drop-down box to ‘Debug’ or higher. The debug output should appear in the ‘Log’ area of the main window (if not, try restarting the program).You can copy and paste the text from this window.

If you want to delve deeper into Synergy or want to contribute to the Synergy project, visit the official website http://synergy-project.org/.

NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here