This guide describes how to configure various settings for CAN interfaces on Linux using the `ip` command line tool. # Basic Interface Configuration For most use cases all that is required to be configured is the bitrate before bringing the interface up to received and send frames. The example command below configures the interface `can0` at a bitrate of 125kbit/s and starts the interface. ```shell ip link set can0 up type can bitrate 125000 ``` # Displaying Interface Statistics Sometimes when troubleshooting an interface, it is useful to inspect the statistics for information like dropped frames, bus errors and other status information. This can be done with the following command. ```shell ip -details -statistics link show can0 ``` # Enabling FD Frames Whilst CAN FD capable interfaces will receive FD frames by default, to transmit frames using bitrate switching and take advantage of higher data rates, both the nominal bitrate and data bitrate must be provided in the command. The below command configures the nominal bitrate at 500kbit/s and the data bitrate at 4Mbit/s. ```shell ip link set can0 up type can bitrate 500000 dbitrate 4000000 fd on ``` # References - [The Linux Kernel - SocketCAN](https://docs.kernel.org/networking/can.html)