Configuring Separate Gateways for Dual Ethernet Ports on the cRIO Device

Updated Oct 11, 2025

Environment

Hardware

  • CompactRIO Controller

This document provides instructions for configuring separate gateways for the two Ethernet ports on the cRIO device.

 

When working with multiple network interfaces, it's important to follow recommended guidelines to ensure reliable communication and avoid routing conflicts. For reference, see Best Practices for Using Multiple Network Interfaces (NICs) with NI Products

 

In this article, we focus on Case 4: Connecting to Two Routed Networks (Advanced)—a configuration scenario highlighted in the NI best practices guide.

 

The figure below illustrates Case 4: Connecting to Two Routed Networks (Advanced), as described in Best Practices for Using Multiple Network Interfaces (NICs) with NI Products.

Case 4: Connecting to Two Routed Networks (advanced)

 

On NI Linux Real-Time systems, the ip route add command can be used to manually add a route to the kernel's IP routing table. This command specifies how the system should reach a particular IP address or network, including which interface or gateway to use.

 

The table below provides example IP addresses for two NICs, which will be used in the commands later in this guide.

NIC 1NIC 2
IP Address: 10.0.0.5IP Address: 10.0.1.5
Subnet Mask: 255.255.255.0Subnet Mask:255.255.255.0
Default Gateway: 0.0.0.0 (unspecified)Default Gateway: 0.0.0.0 (unspecified)
Special Route: Use NIC 1 and gateway 10.0.0.1 to route to 192.168.0.xSpecial Route: Use NIC 2 and gateway 10.0.1.1 to route to 192.168.1.x

 

Linux shell command (Linux RT):

# Route traffic to 192.168.0.0/24 via gateway 10.0.0.1 using NIC1 (eth0)

ip route add 192.168.0.0/24 via 10.0.0.1 dev eth0

# Route traffic to 192.168.1.0/24 via gateway 10.0.1.1 using NIC2 (eth1)

ip route add 192.168.1.0/24 via 10.0.1.1 dev eth1

Command Breakdown:

  • ip route add: Adds a new route to the system's routing table.
  • 192.168.0.0/24: Specifies the destination network (subnet with a 255.255.255.0 mask).
  • via 10.0.0.1: Defines the gateway IP address for reaching the destination network.
  • dev eth0 / dev eth1: Indicates the network interface to use for the route.

You can verify if the routing is configured correctly by using the ip route show command.

To run these commands, you can refer to the NI guide titled Accessing the Shell on NI Linux Real-Time Devices