selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

GitHub
mbusd logo

Self-host mbusd

v0.5.3

Modbus TCP to RTU gateway for serial devices

ReleaseOpen SourceBSD-3-Clause
Updated2 weeks ago
LanguageC
Setup difficultyModerate
Stars
684
Port
502 (Modbus TCP server)
Docker
3cky/mbusd
Install with Build from Source

What is mbusd?

This gateway connects Modbus TCP clients to RTU serial devices, acting as a TCP server that becomes an RTU master on the serial bus. Multiple TCP clients can share the same RS-232 or RS-485 line. Serial parameters like baud rate, parity, and timeouts are fully configurable. It handles RS-485 direction control automatically or via RTS, and can discard local echo from adapters that loop back transmissions. Standard function codes 1-7, 15, and 16 are supported; others work best-effort. Deployment options include building from source with CMake, running as a systemd service, or using the Docker image. The default port 502 needs root access. Settings come from command-line flags or a config file.

Should you self-host mbusd?

mbusd scores 52/100 on selfhost.directory (how scoring works) and ranks #3 of 4 in Industrial IoT. It has 684 GitHub stars.

It shipped 1 stable release in the past year. The latest, v0.5.3, came out on 7 April 2026.

Setup is moderate: expect some configuration beyond a single command. An official Docker image is available. It is BSD-3-Clause-licensed and written mostly in C.

Its closest alternative on selfhost.directory is LinuxCNC (63/100, 2 512 stars). It scores higher overall, so compare the two before you pick. See mbusd vs LinuxCNC side by side.

Features

  • Configurable RTU serial parameters
  • Configuration file support
  • Local echo handling
  • Modbus TCP to RTU gateway
  • Multi-master support
  • Request retry with CRC validation
  • RS-485 direction control
  • Standard Modbus function codes
  • Systemd service support

mbusd README

How to install mbusd

Install mbusd with Build from Source

git clone https://github.com/3cky/mbusd.git mbusd.git cd mbusd.git mkdir -p build && cd build cmake -DCMAKE_INSTALL_PREFIX=/usr .. make sudo make install

Compile-time options can be altered with ccmake or cmake-gui

How to configure mbusd

  • address0.0.0.0TCP server address to bind

    TCP server address to bind

  • device/dev/ttyS0Serial port device name

    Serial port device name

  • enable_rs485noEnable RS-485 support for given serial port device (Linux only)

    Enable RS-485 support for given serial port device (Linux only)

    values: yes/no

  • local_echonoDiscard exactly one locally echoed RTU request, including CRC

    Discard exactly one locally echoed RTU request, including CRC

    values: yes/no

  • logfile/var/log/mbusd.logLogfile (fully-qualified path, or filename stored at /var/log/ or - for STDOUT only)

    Logfile (fully-qualified path, or filename stored at /var/log/ or - for STDOUT only)

  • loglevel2Logging verbosity level

    Logging verbosity level

    values: 0-9

  • maxconn32Maximum number of simultaneous TCP connections

    Maximum number of simultaneous TCP connections

  • mode8n1Serial port mode

    Serial port mode

  • pause100Pause between requests in milliseconds

    Pause between requests in milliseconds

  • port502TCP server port number

    TCP server port number

  • replyonbroadcastnoReply on Broadcast

    Reply on Broadcast

    values: yes/no

  • retries3Maximum number of request retries

    Maximum number of request retries

  • speed9600Serial port speed

    Serial port speed

  • timeout60Connection timeout value in seconds

    Connection timeout value in seconds

  • trx_controladdcRS-485 data direction control type

    RS-485 data direction control type

    values: addc, rts_0, rts/rts_1, sysfs_0, sysfs_1

  • trx_sysfileSysfs file to use to control data direction

    Sysfs file to use to control data direction

  • wait500Response wait time in milliseconds

    Response wait time in milliseconds

mbusd releases & version history

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…