Setting up Multiple IP Addresses on One CompactRIO

Updated May 3, 2018

Reported In

Hardware

  • CompactRIO Controller

Operating System

  • NI Linux Real-Time

Issue Details

I am using the IEC 61850 MMS toolkit to simulate multiple MMS servers on a cRIO-9038. Currently I have it setup so that I have 3 servers each with the same IP address but listening on separate ports, i.e. 4102, 4103, and 4104. However I would like to run these servers with different IP addresses e.g. 10.0.0.99, 10.0.0.100, 10.0.0.101 etc. but on the same port. Is there a way to set the cRIO-9038 so that it has three or more distinct IP addresses? 

Solution

There is no official support for multiple IPs on one network interface of a CompactRIO.

However, for all CompactRIOs running on NI Linux like the cRIO-9038 there is a solution. Following are the steps to implement it. The cRIO-9038 has two network interfaces (NICs). eth0 will be used as the configuration interface in this example, eth1 as the public one connected to the clients. Generally this setup will also work on a single NIC.
  1. Use NI Measurement & Automation Explorer (MAX) to configure eth0 to either have a static IP or to use DHCP
  2. Use MAX to configure eth1 to Static and set the first IP to use on this NIC (e.g. 10.0.0.99)
  3. Use MAX to verify that SSH is enabled (Checkmark at Enable Secure Shell Server (sshd)).
  4. Verify there is a user with a set password.
  5. Access the cRIO via SSH (e.g. using putty).
  6. Edit /etc/natinst/networking/ifplugd.script to define additional IPs. You can use the editor vi available on NI Linux to do so:
    1. Start the editor using the command vi /etc/natinst/networking/ifplugd.script
    2. Switch to edit mode by pressing i
    3. Insert this section directly before the line update_interface_info $INTERFACE:
      if [ "$INTERFACE"=="eth1" ]; then 
        ip addr add 10.0.0.100/8 dev eth1; 
        ip addr add 10.0.0.101/8 dev eth1; 
        ip addr add 10.0.0.102/8 dev eth1; 
      fi 
Notes: Change eth1 to the interface you are using, e.g. eth0. Add more IP lines to wish. Do not accidentally reuse the "first IP" you have set in MAX.
  1. Press Esc to leave edit mode. 
  2. Type :wq and press Enter to save and quit (:q! + Enter to quit without saving).
  1. Plug a network cable into eth1 to connect the network port to something (e.g. a switch), or unplug and re-plug it if it was connected before. Now the NIC should have all the IPs you defined. 
  2. Use ip add list eth1 to check.
You should now be able to use all different IP addresses to connect to the CompactRIO. E.g. several MMS servers can run simultaneously, each with a different IP.

Additional Information

  • Be very careful when doing changes to cRIO's network configuration, as any error might shut down all network traffic on the affected NIC, including the SSH connection. This is a general configuration restriction, not a restriction of cRIO or NI Linux.
  • Commands similar to ip addr add 10.0.0.100/8 dev eth1 can be used on the shell (Linux' command line) directly to temporarily change the NIC's configuration. This change will be reset when the network cable is unplugged, the connection is reset (e.g. when the switch on the other end of the cable is power-cycled), or when the cRIO reboots.
  • MAX will not show the additional IP address(es).
  • Using MAX to change the configuration of the "first IP" does not remove the additionally configured IP address(es).
  • /etc/issue will not show the additional IP address(es).
  • This was tested on a NI cRIO-9065 with:
#admin@cRIO-9065-ik: cat /proc/version
Linux version 4.6.7-rt14-ni-5.0.0f0 (lvbuild@2017RTLin.amer.corp.natinst.com) (gcc version 4.7.2 (GCC) ) #1 SMP PREEMPT RT Fri Mar 10 02:40:15 CST 2017
  • When using IP addresses from multiple subnets on one NIC, the external network hardware must be capable of routing multiple subnets to one network interface. In that case using VLANs could be more convenient. 

WAS THIS ARTICLE HELPFUL?

Not Helpful