Network and SSH

Experimental. Try it in the demo. The source code is not public yet: file paths below refer to it.

Machines in tabs of one browser share a network. There is no internet and no other computer. Any page served from the same origin could listen to or join it.

SSH between two tabs

  1. Open linux.html?safe=1&net=1 in two tabs and press Boot in each. Safe mode matters: a saved disk opens in only one tab. The page shows each address, normally 10.0.0.1 then 10.0.0.2.
  2. In the first tab, check the link:
    ping -c 3 10.0.0.2
  3. In the second tab, set a password. Run this command, then type a password you make up, twice. Nothing shows while you type.
    passwd
  4. Still in the second tab, once the ~ # prompt is back, start the server. This is a command, not part of the password; it may print nothing.
    dropbear -R
  5. In the first tab, log in with the address the second tab shows. Answer y to the host key question, then type that password:
    ssh root@10.0.0.2
    hostname        # then, on the other machine: sosie2
    exit
  6. Copy a file:
    echo hello > /tmp/f
    scp -S /usr/bin/ssh /tmp/f root@10.0.0.2:/tmp/

As shipped, no server runs and root is locked: nothing accepts a login until you run passwd and dropbear -R. Check the fingerprint if it matters to you; the automated tests accept host keys unchecked (ssh -y).

nc works for raw transfers, but BusyBox's receiver does not exit when the sender closes. A terminal in a hidden tab is not redrawn: switch to the tab to see its output.

A saved disk made before SSH was added keeps its old system, which has no SSH. Use safe mode or a new saved disk. It still gets a network address.

Network unreachable means that machine booted without the network. Ticking the box while it runs does nothing: power it off and boot again. Every machine taking part must show “Network: this machine is 10.0.0.N” on the page.

How it works

PieceWhat it doesSource
virtio-net deviceReceive and send queues, frames of 14 to 1514 bytes, no offloads; Linux picks a random MACsrc/virtio.src
Link between tabsBroadcastChannel, behaving like a hubweb/net-hub.js, web/net-tabs.js
Address10.0.0.N, held per tab by a Web Lock, passed as sosie.host=Nweb/net-tabs.js, linux/init
Paced sleepA sleeping machine's clock advances only by the time really passedsrc/machine.src
SSHDropbear 2026.94, one static rv64ima program on the system disklinux/build-dropbear.sh
Under NodeThe same device, frames over UDP on 127.0.0.1: --net PORT:PEERPORTwasm/run.mjs

Why paced sleep: without a network the emulator jumps its clock to the next timer when Linux sleeps. With one, a 3 s wait for a reply ended after 0.04 s. A busy machine's clock still counts instructions, so it can drift from its peer.

The native build has no real network: only --net-echo, which returns each frame, for device tests. The build of Dropbear has no syslog, so it has no -E option and logs to stderr. A refused login looks to the client like any closed connection: read the server's log (dropbear -R 2>>/tmp/ssh.log).