Search

Ads

Thursday, March 20, 2014

How to Configure Synergy on Linux to Share Keyboard and Mouse with Multiple Systems

How to Configure Synergy on Linux to Share Keyboard and Mouse with Multiple Systems

by Sanjay Kumar on March 19, 2014
Synergy is an open source network utility which can be used to share one keyboard and mouse with multiple systems.
Synergy utility works on client-server model.
The system whose keyboard and mouse you want to share, runs the synergy server service (synergys), and all the other systems runs the synergy client service (synergyc) to connect to server.
Synergy is a platform independent utility. Compiled version of synergy is available for various platforms including Windows, Linux, Mac OS X, Android and Apple iOS. You can download source code and compiled version from here.

Use the appropriate package management command to install Synergy on your system as shown below. For Windows, you can directly download executable and install it.
# For Mac OSX :
sudo port install synergy

# For Fedora, CentOs and RHEL :
sudo yum install synergy

# For Ubuntu, LinuxMint and Debian :
sudo apt-get install synergy

Example Synergy Configuration Setup

In my case, I have three systems mac-dev (OSX Maverick 10.9.1), nix-dev (Ubuntu), fed-dev (Fedora 20) which is connected in local network.
Synergy Keyboard Mouse
After installation, you need to define a configuration file to run synergy.
Configuration file has information about how these systems are connected in X,Y Plane. The synergy configuration file has the following sections:
  1. screens
  2. links
  3. aliases
  4. options
The default syntax of all sections is shown below. Just replace the name to one of the above section name.
section: name
arguments
end

Screens Section

Screens section will specify how many systems are going to connect through synergy service.
In screens section, either you can use either ip address or hostname of the systems.
Following is my configuration file for screens section. Here I’ve used two hostname and one ip-address (for fed-dev system).
section: screens
10.112.10.27:
nix-dev:
mac-dev:
end

Links Section

Links section will specify how these systems are going to connect in X,Y Plane.
There are four options such as left, right, down and up to connect screens to each other. Before writing link section, keep the system on which you want to run synergy server service ( it means you want to use keyboard and mouse of the system in all systems which are connected across local network.
In my setup, I want to use nix-dev systems keyboard and mouse in mac-dev, and fed-dev. So, I kept nix-dev in center and mac-dev of left of nix-dev and fed-dev is right of the nix-dev. In links section, you can write any screen first or last, it doesn’t matter.
section: links
nix-dev:
left = mac-dev
right = 10.112.10.27
mac-dev:
right = nix-dev
10.112.10.27:
left=nix-dev
end

Aliases Section

In aliases section, you could write alias for domain name to use short name in screens and links sections.
section: aliases
nix-dev:
nix-dev.thegeekstuff.com
mac-dev:
mac-dev.thegeekstuff.com
end

Options Section

In options section, there are list of arguments which can be use to modify uses of synergy service in configuration. You can get full list of options from synergy website.
section: options
keystroke(alt+left) = switchInDirection(left)
end

Start Synergy Service

For minimum configuration, you need atleast two options such as screens and links.
In the system which has keyboard and mouse, you need to start synergy server service as shown below, which will wait for all client to connect according to configuration file.
synergys -f -c mysynergy.conf
-f flags : To run synergy server service in foreground, by default it runs in the background
-c flags : to pass configuration file to synergy server service

For other connected systems, start synergy client service with server hostname or server ip address on which synergy server service is running as shown below.
synergyc -f nix-dev

or

synergyc -f 10.112.10.26
-f flags : to run synergy server service in foreground

Debugging Synergy Issues

The following “failed to connect to server” is a common synergy service error message.
WARNING: failed to connect to server:
NOTE: connecting to ’nix-dev’: 10.112.10.26:24800
In most case, the above error message is because of the firewall not allowing the client to talk to the server. Modify the iptables rules accordingly to allow port 24800.
If you have’ve installed different version of synergy client and server, you might get the following message. In this case, make sure to install the same version on both server and all the clients.
WARNING: failed to connect to server: incompatible client 1.4
NOTE: connecting to ’nix-dev’: 10.112.10.26:24800

Linux Sysadmin Course Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.
Get the Linux Sysadmin Course Now!

No comments:

Post a Comment