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.
- Use NI Measurement & Automation Explorer (MAX) to configure eth0 to either have a static IP or to use DHCP.
- Use MAX to configure eth1 to Static and set the first IP to use on this NIC (e.g. 10.0.0.99)
- Use MAX to verify that SSH is enabled (Checkmark at Enable Secure Shell Server (sshd)).
- Verify there is a user with a set password.
- Access the cRIO via SSH (e.g. using putty).
- Edit /etc/natinst/networking/ifplugd.script to define additional IPs. You can use the editor vi available on NI Linux to do so:
- Start the editor using the command vi /etc/natinst/networking/ifplugd.script
- Switch to edit mode by pressing i
- 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;
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.
- Press Esc to leave edit mode.
- Type :wq and press Enter to save and quit (:q! + Enter to quit without saving).
- 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.
- 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.
- 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.