Automatically bring up socketcan network interfaces on boot (can0, ...)
I have a couple of machines that use socketcan for CAN interfaces.
The hardware driver is loaded by modprobe pcan
, and that module is currently magically configured to start itself on boot, which is working fine.
But every time I reboot, I have to bring up the network interfaces manually, e.g.:
sudo ip link set can0 up
sudo ip link set can1 up
sudo ip link set can2 up
sudo ip link set can3 up
What is the best way to bring up the canX
interfaces on boot (and also making sure that they don't come up until the pcan
module is loaded)?
I'm pretty sure you can just throw them into your rc.local file
sudo nano /etc/rc.local
#!/bin/sh -e
sudo ip link set can0 up
sudo ip link set can1 up
sudo ip link set can2 up
sudo ip link set can3 up
exit 0