Setup PRP

For handling the Parallel Redundancy Protocol (PRP) packets in the Gateway, it is recommended to use the already existent Linux kernel module hsr. The driver is installed by default on most Linux distributions.

The following command can be used to check if the hsr module is already loaded:

lsmod | grep hsr

If there is no output it either needs to be loaded or it needs to be compiled from source.

Setup a PRP virtual network interface

Add PRP link

ip link add dev prp0 type hsr slave1 <interface_1> slave2 <interface_2> proto 1

Set interface up

ip link set dev prp0 up

Compile the hsr driver from source

This process will differ depending on the Linux distribution. The following steps refer to the Realtime kernel of Debian 6.1

Download the kernel source

cd /usr/src
apt source linux

Patch the realtime kernel

cd linux-source-*
for p in ../linux-debian-6.1-bookworm/debian/patches-rt/*.patch; do patch -p1 < "$p"; done

Copy the current kernel configuration

cp /boot/config-$(uname -r) .config

Activate the compilation of the hsr module

make menuconfig
# Navigate to Networking Support > Network Options > High-availability Seamless Redundancy (HSR & PRP)
# Set that option to M (module), this can be done by pressing M
# Save and Exit

Ensure both HSR and PRP are selected

cat .config | grep CONFIG_PREEMPT_RT
# This should output: CONFIG_PREEMPT_RT=y
cat .config | grep CONFIG_HSR
# This should output: CONFIG_HSR=m

Compile all modules

# This will take a few hours
make -j$(nproc) modules

Install and load the module

cp net/hsr/hsr.ko /lib/modules/$(uname -r)/kernel/net/hsr/
depmod -a

# Set to start at startup
echo hsr | sudo tee /etc/modules-load.d/hsr.conf

Load the HSR module

modprobe hsr