Synergy

From Linuxintro

Synergy is a software suite that allows you to control two or more computers over the network using several screens, but only one mouse and keyboard.

Just follow https://help.ubuntu.com/community/SynergyHowto#Manual%20Configuration.