Setting up a NI Linux Real Time System to Bridge Ethernet Ports

Updated Jun 27, 2023

Environment

Driver

  • NI-RIO

Operating System

  • NI Linux Real-Time

How can I setup a NI Linux Real-Time system to bridge the Ethernet ports so as to:
  • Connect seperate subnets?
  • Enable STP support?

You can achieve a bridged connection by installing the Linux package bridge-utils and then configuring this using the interfaces file located in /etc/network/.

To begin, you must first enable SSH and connect to the device via PuTTY for an SSH session. This article provides step-by-step instructions on how to achieve this: How Do I Enable the Console Out on CompactRIO, Single-Board RIO, CompactFieldPoint Controllers? ​ 

Note: It is recommended to keep console out and SSH enabled throughout this process. In the event of an error or incorrect configuration, SSH can be the only way to undo changes and return to an operational state. By modifying the ethernet adapters, you are running the risk of making the device permanently inaccessible unless SSH is enabled. In addition, it is also recommended to maintain these settings afterwards to provide a permanent method of reconfiguration if corruption does occur.
 



Next, login as the admin user (root):



Then input opkg update. 

This will check the repository for any available updates.



Now you can install the bridge-utils package using the command opkg upgrade bridge-utils.



Next, connect to the device via ftp.



Then navigate to /etc/network:



Copy interfaces to your PC. At this stage, it is also recommended to save a back-up copy of the interfaces to return to the previous configuration if errors occur. Modify the file to your needs (the commands are explained below) and upload this back to /etc/network/, replacing the current interfaces file.



The line iface br0 inet static sets up the Interface to have a static IP address (10.100.1.150). The subnet mask has also been set up as 255.255.255.0 by setting the network, gateway, and dns-nameservers to 0.0.0.0. These will be automatically detected just as DHCP would -- this is recommended to provide reliability.

Note: it is recommended to set up a static IP address with this configuration, as issues may be found with connectivity through NI MAX and LabVIEW to the cRIO if the DHCP has incorrectly configured the IP settings. The Static IP address for the bridge will be that of the cRIO controller performing the bridge, and not the device being bridged to.
Lines with pre-up preceding a command specify that the command is to be run before bringing the bridge up. Lines with post-down also specify commands to be run after shutting the bridge down.
The line pre-up brctl stp br0 on enables STP (Spanning Tree Protocol) on bridging the bridge online. RSTP is backwards compatible with STP, so any router/switch using RSTP will also be able to use this protocol with the bridges.

Restart the device through NI MAX:



You should now see three ethernet adapters, one of which is the bridge (br0):



Note: This setup will result in NI MAX not being able to adjust settings, place the device into configuration mode, install/uninstall software or format the disk. To return the device to the previous configuration, replace the interface file with the previous interface file backed up and then reboot the machine. Screenshots of these errors are provided below:




The device and any daisy-chained devices will be visible in NI MAX. They should be auto-discoverable in LabVIEW as well, though you may need to add these as a New Target or Device and then configure the static IP address set for the device that is acting as the bridge.