Skip to content

catid/kvm

Repository files navigation

Logo Low-Bandwidth IP KVM using Raspberry Pi 4

Provides secure out-of-band remote management of IT assets, for under $100.

This is the first Raspberry Pi KVM project to implement WebRTC video streaming to the browser, reducing bandwidth by 15x or more, and allowing for access to LAN assets over VPN instead of requiring local WiFi connection.

By connecting your Raspberry Pi 4 to the HDMI and USB ports of a target device, you can use a web browser to access the target remotely, as if you were sitting at the target with a keyboard and mouse attached. You will be able to access the BIOS and boot menus of the device remotely.

Project Video

Features:

  • The browser displays video from the target device.
  • Keystrokes and mouse movements are relayed to the target device.
  • Supports multiple sessions with the device in different browser windows.
  • All data sent over the network is encrypted using TLS.
  • Robust to replugging HDMI capture card while in use.
  • CBR H.264 WebRTC video and data channels are used to ensure consistently low latency.
  • Motion (click/key) to photons (video update in browser) latency: 200 milliseconds.

Overview

Hardware Required: Connect all the hardware.

OS Installation: Set up the Raspberry Pi with SSH and WiFi access.

Windows Setup: Prepare the Windows computer to access the Raspberry Pi by hostname, and install a terminal app.

Software Installation: Clone this repo, build the software, and run the install script as root.

How To Use: Connect the Pi to a target device.

Navigate to https://kvm.local/ to access the KVM web app.

Example Usage

Hardware Required

Amazon List (Containing these items): https://www.amazon.com/hz/wishlist/ls/25IKRAT6M9NGW

Required hardware:

Hardware Setup

The software is compatible with this fanless heatsink case and will not cause it to overheat.

Recommended additional hardware:

When working with target devices that cannot supply full power to the Raspberry Pi over the USB-C cable, you can use a splitter:

OS Installation

Install the Raspbian OS on your Raspberry Pi 4 and configure its hostname.

Insert SD Card into the SD Card Reader, and insert the reader into your computer.

On Windows, download the Raspberry Pi Imager and use it to flash the SD card.

https://www.raspberrypi.org/software/

After flashing the SD card, while it is still plugged into your computer, open the mounted SD card folder and add two new files:

These modifications will enable SSH over WiFi for the Raspberry Pi without needing to attach a keyboard/monitor to the Pi.

This software currently requires that most of the system settings are the defaults, so avoiding unnecessary customization is recommended (at first). For example the user name should be pi which is the default.

Windows Setup

On Windows you will need to install the Bonjour Print Services for Windows to resolve the hostname kvm.local:

https://support.apple.com/kb/DL999?locale=en_US

You will also need a terminal with SSH. I recommend Git Bash from https://gitforwindows.org/

Software Installation

SSH into the Raspberry Pi at a terminal on your computer (over WiFi): ssh pi@raspberrypi.local with password raspberry.

Use sudo raspiconf on the Pi to change the hostname of the Raspberry Pi to kvm. There is a guide here: https://www.tomshardware.com/how-to/raspberry-pi-change-hostname

This may be a good time to change the SSH password on the device to a more secure password.

Build and install the KVM software in the SSH session:

sudo apt update
sudo apt install -y git janus janus-dev cmake g++ libglib2.0-dev libturbojpeg0-dev
sudo systemctl disable janus

cd ~
git clone https://github.com/catid/kvm.git
cd kvm

mkdir build
cd build
cmake ..
make -j4

cd /home/pi/kvm/scripts/
sudo ./install.sh

sudo sync

sudo reboot now

On older versions of Raspberry Pi OS, the make -j4 step will fail. This is because the janus-dev package API changed. To build on older Raspberry Pis, check out the special branch for this case, and then attempt to build again:

git checkout old-janus
make -j4

When the Raspberry Pi reboots, it will be hosting the KVM services. You can view the logs by connecting to ssh pi@kvm.local with password raspberry, and then entering sudo journalctl -fu kvm_webrtc -n 10000

How To Use

Insert the HDMI/USB Capture Card into one of the two Blue Middle USB3 ports on the Raspberry Pi 4. Connect the HDMI cable to the target device.

Insert the USB-C to USB-A Adapter Cable into the USB-C port on the Raspberry Pi 4. Connect the USB-A cable to the target device.

Power on the target device.

Navigate to https://kvm.local/ to access the KVM web app.

Credits

The most complete Pi KVM project is probably https://github.com/pikvm/pikvm/ which has a lot of additional features, such as supporting other video capture hardware and other versions of the Raspberry Pi. The Pi KVM project has a wealth of information in the repo and has been in development for years.

The keyboard/mouse driver setup script is copied from the (MIT Licensed) TinyPilot software project at https://tinypilotkvm.com/

The author of TinyPilot is pushing towards commercializing using the Raspberry Pi for KVM. I did not personally decide to commercialize this hardware solution because multiple products for IP-KVM already exist. It does seem to be producing a decent income for the author of TinyPilot despite the competition, which is interesting.

Software by Christopher A. Taylor mrcatid@gmail.com

Please reach out if you need support or would like to collaborate on a project.

About

Low-Bandwidth IP KVM using Raspberry Pi 4

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published