Setting up Virtual CAN - MacRover/maxwell GitHub Wiki

VCAN Interface

Starting up VCAN:

sudo modprobe can
sudo modprobe can_raw
sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0

Run ip a. You should see that vcan0 is up and running with an UNKNOWN state.

Testing VCAN

First, make sure you have the can-utils package installed.

sudo apt install can-utils

Then in one terminal, run:

candump -tz vcan0

Open another terminal and run:

cansend vcan0 123#abcdabcd

If everything works, the CAN message should pop up in the candump.