All you need is a cangw tool from can-utils . Create two virtual interfaces:
ip link add dev vcan0 type vcan
ip link add dev vcan1 type vcan
ip link set up vcan0
ip link set up vcan1
Create a routing rule so that all packets included in vcan0 are sent to vcan1 :
cangw -A -s vcan0 -d vcan1 -e
Listen to vcan1 in one terminal:
candump vcan1
And send the packet from another terminal:
cansend vcan0 123
You will see that candump will receive this CAN packet:
vcan1 123 [2] 00 11
source
share