The device you're looking for is called a KVM (Keyboard / Video / Mouse) "switch". They exist for both USB and PS/2-style keyboards and mice. They're for sharing keyboard, video, and mouse between multiple machines.
Some motherboards don't like the keyboard and mouse being switched away and some of the better KVMs have hardware that makes the mouse and keyboard appear to exist for all connected computers but only send the keyboard and mouse events to the selected computer. Those are the better KVMs.
You could also use a program like VNC, or log in to from one box to the other via XWindows / XDMCP. You could also use a program like Synergy (http://synergy-foss.org
) to "share" the keyboard and mouse with the computer whose screen you move the mouse to.