Example Code

Programmatically Change Network Settings for Linux RT CompactRIO Targets

Code and Documents

Attachment

Overview

 This example demonstrates how to change the network settings for the 2 ethernet ports in a Linux RT CompactRIO Controller. 

Description

 Network settings can be configured for both eth0 and eth1 in Linux RT targets with 2 ethernet ports. This can be done regardless of the connection being used (usb, eth0 or eth1).network settings.png

 

Configurable settings for each port are:

  • IP Address Request Mode.
  • IP Address.
  • Gateway.
  • Subnet Mask.
  • DNS.

The target's hostname can also be changed. 

 

Hardware and Software Requirements

Hardware:

-Linux RT CompactRIO Target.

 

Sofware:

-LabVIEW 2016 or later.

-NI System Configuration 16.0 or later. 

 

Steps to Implement or Execute Code

1. Open the Change Network Settings Linux RT.lvproj file.

2. Open and run the Main - Change Network Settings.vi.

3. Enter a valid IP address for the cRIO.

4. Click on Connect.

5. A new window will open where you can change the network settings for the 2 ethernet ports in the CompactRIO. 

6. Click on Apply and Reboot to change the settings.

 

Additional Information or References

This example was made reusing some of the code used in the Replication and Deployment Utility (RAD) to change network settings. This was modified to allow changing settings for the 2 ethernet ports regardless of the connection being used (usb, eth0 or eth1).

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors