Feature request: ship bridge support (CONFIG_BRIDGE) so the virtual network can be bridged to the LAN

Open
#993 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
c, linux

Research direction

Start with the referenced sg2002_licheervnano_sd_defconfig in LicheeRV-Nano-Build and check how kernel modules are selected and included in the image. The proof of concept links reproducible build notes and scripts; compare that setup with the stock image configuration. Done when bridge support and its required modules are shipped, while the existing eth0-dependent network checks and rules continue to work.

Written by the indexing model from the issue text.

Description

Use case

There is only one LAN cable at the remote PC. The NanoKVM takes it, but the target PC still needs network. The USB virtual network (RNDIS) already runs over the same cable as keyboard and mouse, but it is an isolated 10.x.x.x/24 with no gateway, so the target can only reach the KVM. #98 shows several people asking for exactly this ("Would love to remove duplicate ethernet cables").

Problem

The stock kernel (5.10.4-tag-, image 2025-04-17) has # CONFIG_BRIDGE is not set and ships no bridge module, so ip link add br0 type bridge fails. The workarounds in #98 use NAT. That works for internet, but the target hides behind the KVM's IP and is not a normal LAN client.

Request
  1. Enable CONFIG_BRIDGE=m (which selects CONFIG_LLC / CONFIG_STP) and ship the modules in the image. The defconfig appears to be build/boards/sg200x/sg2002_licheervnano_sd/linux/sg2002_licheervnano_sd_defconfig in LicheeRV-Nano-Build. Loaded, the three modules take about 185 KB of RAM, and they change nothing unless someone uses them. CONFIG_BRIDGE_NETFILTER can stay off.
  2. Optional: a web UI setting "Virtual network: isolated / bridged to LAN".
Working proof of concept

I built llc, stp and bridge out-of-tree from LicheeRV-Nano-Build (linux_5.10) against the device's own /proc/config.gz and run a bridge on a NanoKVM Cube (app 2.5.4, image 2025-04-17):

  • The target PC gets a DHCP lease from the LAN router over the USB cable.
  • Keyboard, mouse and HDMI keep working. Tailscale on the KVM keeps working.
  • The KVM stays reachable when nothing is on USB.

One thing to watch if you implement it natively: kvm_system (ping -I eth0, ip route | grep eth0), S30eth and the iptables rules in S95nanokvm are hard-wired to eth0. My workaround renames the physical port to lan0 and names the bridge itself eth0, so all of that keeps working unchanged. A native implementation would either do the same or make those checks follow the bridge.

Scripts, reproducible build and notes: https://github.com/cepheiden/nanokvm-bridge

Dominant language
TypeScript
Stars
6.6k
Forks
357
Avg merge
13h 35m
Merged PRs (30d)
5

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • No Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sipeed/NanoKVM

All issues in sipeed/NanoKVM

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.