# Connecting to a CAN bus via a remote computer

**URL:** <https://forum.opencyphal.org/t/connecting-to-a-can-bus-via-a-remote-computer/1726>\
**Category:** Applications & Usage\
**Created:** [August 2, 2022, 2:48pm UTC](https://forum.opencyphal.org/t/connecting-to-a-can-bus-via-a-remote-computer/1726 "2022-08-02T14:48:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [August 2, 2022, 2:48pm UTC](https://forum.opencyphal.org/t/connecting-to-a-can-bus-via-a-remote-computer/1726/1 "2022-08-02T14:48:59Z")

</div>

Suppose we have two PCs on the same network (which could be a VPN). There is a SLCAN adapter connected to PC A; we are sitting in front of PC B and want to interact with the CAN bus to which PC A is connected. Both PCs run GNU/Linux.

Install can-utils on both PCs (APT/AUR package `can-utils`). Grab cannelloni, build & install it on both PCs following the instructions in the README:

> **[GitHub - mguentner/cannelloni: a SocketCAN over Ethernet tunnel](https://github.com/mguentner/cannelloni)**
>
> a SocketCAN over Ethernet tunnel

Don’t forget to do `sudo ldconfig` after installation (or `sudo ldconfig /usr/local/lib` or whatever if the installation destination is not configured as a default ldconfig path). Then grab [setup\_slcan -- a simple script for managing SocketCAN SLCAN interfaces on GNU/Linux · GitHub](https://gist.github.com/pavel-kirienko/32e395683e8b7f49e71413aebf5e1a89) and put it in your PATH.

## On PC A

Initialize `slcan0`:

```bash
sudo setup_slcan -r /dev/serial/by-id/usb-Zubax_Robotics_Zubax_Babel_32003D000757424E3430302000000000-if00

```

Run the bridge:

```bash
cannelloni -I slcan0 -R 192.168.1.200

```

## On PC B

Set up `vcan0`:

```bash
sudo modprobe can
sudo modprobe can_raw
sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set vcan0 mtu 72 # Optional: Enable CAN FD by configuring MTU=64+8
sudo ip link set up vcan0

```

Run the bridge:

```bash
cannelloni -I vcan0 -R 192.168.1.6

```

## Test

Ensure there is something connected to PC A’s CAN bus. Ensure you have [Yakut](https://github.com/OpenCyphal/yakut) installed & configured. Then you can interact with it from PC B as if it was connected to `vcan0`:

```bash
source env_vcan0.sh # Whatever your configuration is
y mon -P ~/allocation_table.db

```

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [August 10, 2022, 11:45am UTC](https://forum.opencyphal.org/t/connecting-to-a-can-bus-via-a-remote-computer/1726/2 "2022-08-10T11:45:42Z")

</div>

If you want to remotely upload new software, simply say:

```bash
y file-server /path/to/firmware/dir/ --update-software

```

You can also say this to force an update regardless of the version check:

```bash
y file-server /path/to/firmware/dir/ --update-software=125 # 125 is the node-ID here

```

The process will take some time, though, because cannelloni introduces a significant latency, and all request-response interactions (like the firmware download) are affected.
