LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RT: How do I use two independent Ethernet ports?

I have looked around at the forums and seems like no one has had a real solid answer or example on how to use 2 Ethernet ports with RT.

Right now I have two connections configured on the RT:
------------------------------------------------------------------------
Primary Connection:
IP:192.168.2.181
Subnet mask: 255.255.255.0
Gateway: 192.168.1.1
DNS Server: 192.168.1.1

Secondary Connection:
IP:192.168.1.180
Subnet mask: 255.255.255.0
Gateway: 192.168.1.1
DNS Server: 192.168.1.1


After using this initial setup, I made a RT project where I used 'UDP Open' for both 192.168.2.181 and 192.168.1.180, and had them both read and write in a sequence (Read and Write for the 2.181 connection, then Read/Write for 1.180).

The computer I'm using to send the data is connected to a switch, which in turn is connected to the RT. Both the RT and my host computer have 2 ports, one of them with ports configured to be 192.168.2.x and 192.168.1.x


Using this configuration I get some weird results:
------------------------------------------------------------------------
If I send a packet to 192.168.2.181, I receive it from the UDP Receive vi that has an input connection from my UDP Open assigned to 1.180. I also receive the data the same way when sending packets to 1.180 (as expected). Basicly, no matter what IP I'm sending it to on the RT, the data from either packet will arrive from the same location/vi.

Why is this? Is there anyway to fix this? Did I not configure something correctly?



Does anyone have an example of dual Ethernet ports actually working with LabView RT?

I tried checking out "KnowledgeBase 3VQ6278T: Can I Use Multiple Network Adapters in a PXI or Desktop Real-Time System?", but after following the link to the page, I get:
"Error You are not authorized to view this document". Can any NI people look into this?
 
 
Having to make two IPs with different subnet masks obviously just makes things unnecessarily complicated. Can anyone tell me why LabView/NI did this? I know for a fact this isn't a limitation in hardware.

Any help would be greatly appreciated, thanks!
0 Kudos
Message 1 of 4
(5,662 Views)
Hey Weizbox.

Sorry to hear you're having such a difficult time using multiple ethernet devices with RT. 

Let me go ahead and get the easy stuff out of the way, the link you have is dead because it's archived (and thus removed forever) though unfortunately the link on ni.com wasn't corrected to point to the following resource, which the KB was a word-for-word duplication of (which is supposedly why it was removed):

    http://zone.ni.com/reference/en-XX/help/370622C-01/lvrthelp/configuringdual/

Unfortunately, though, it's much less useful than it sounds.

Before you start feeling like a woodpecker in a petrified forest, lemme fill you in on why the requirement is there for the two ethernet NICs to be on seperate subnets.  Simple enough, it has to do with the network stack on both of the operating systems used for LabVIEW Real-Time - however, the same falls true for even Windows (without using fancy vendor-specific drivers), so let's not be too hasty.  Neither PharLap ETS nor VxWorks, the two OS's used under the hood, support redundant network ports.  Because of this, if you give two (or more in the case of PXI and RT Desktop) ethernet devices IP addresses on the same subnet the routing tables in the network stack get horribly confused and literally cannot resolve the proper adapter, which either brings down the ethernet on the entire system or makes it such that one or more network adapters becomes useless and one adapter takes over all network traffic (there's no way to predict which adapter that will be, nor can you control it based on what's plugged in and what's not).  On Windows this is handled by bridging the adapters, but RT does not yet support bridging (that opens a whole nother can of worms).  Long story short, you still wouldn't be able to give both NICs individual IP addresses on the same subnet. 

Let's take that even one more step.  You cannot simply just assign both ethernet NICs different IP addresses on "virtual" subnets, you actually need to put both NICs on literally different subnets for the network routing to actually work.  Multiple ethernet devices for LabVIEW RT were designed with the following mantra in mind - "The FIRST ethernet device is designed for a TCP/IP network, the SECOND and SUBSEQUENT ethernet device is designed for OTHER protocol uses."  By "OTHER protocol uses" I mean the second NIC should be used for RT Deterministic Ethernet (PXI, RT Desktop, et. al.), direct connections with other targets, and 3rd party or custom ethernet protocols. 

Now, realistically, we can't expect users to not use the second NIC for TCP/IP use, nor should we.  However, if you ARE going to use TCP/IP on the second NIC, you should only use the second NIC for connecting to an unroutable network in the eyes of the first NIC.  So, for instance, the FIRST NIC can have an IP address of 10.0.62.128, but the SECOND NIC would need to have an IP address on 192.168.100.23  - and the 10.0.62.128 should not be able to route a TCP packet to the 192.168.x.x network, and vice versa.  In your example I noticed that both networks used the same Gateway - unless your Gateway is configured to identify and seperate the two networks, it's not going to end well, and you shouldn't expect to be able to send data from one NIC to the other NIC (at least with what you know now).  To reiterate, using multiple NICs using TCP/IP should only be done in cases where you've got (n-1) isolated subnets, where n is the number of NICs you have using TCP/IP.  A classic example of this is a command-based measurement environment; the RT system uses the FIRST NIC to talk to a TCP/IP network, in order to transfer data or provide status to a network, and the second NIC is connected to a TCP/IP network designed specifically for measurement or control, where one node sends commands to a single or multiple nodes on the network at once to perform tasks (like "Take a Measurement", "Stop a motor", "Bake me a Pie", etc...).  The isolated TCP/IP subnet is free from "random" TCP/IP traffic (especially system announcement broadcasts) and can have whatever topology/configuration it wants.  The dual networking allows the RT system to work/communicate/perform on both networks.

I hope this helps shed some light on your situation.

Cheers!
-Danny
Message 2 of 4
(5,639 Views)
Thanks for all that great info Danny! It was very much appreciated Smiley Happy

Basically what I'm attempting to do is connect one port directly to an FPGA, and another one to a switch, and ultimately to a host computer. Since our network will be running with 192.168.x.x, I guess I should change the FPGA and RT/FPGA port to something like 10.10.x.x, since this connection will be solely between the RT and FPGA... is this correct? I'll be working with it a little bit today after recompiling all the FPGA code with the new addresses, but afterwards I'll try to post my settings back up so other people know specificly what can work or not.

What would you suggest me to use as the gateway/subnet mask on the RT if I were to set the FPGA up as 10.10.10.1 and the 2nd RT port as 10.10.10.2? Just want to make sure I'm doing some of this stuff correctly and get a better understanding of whats going on. You gave great info tho, and it's helped a lot!

Thanks again!


0 Kudos
Message 3 of 4
(5,604 Views)
Hi weizbox,

In addition to great information that Danny posted, you can also consult the following knowledgebase article: How do I Configure the Dual Ethernet Ports on Real-Time Controllers?

You should be able to configure your dual-port RT target as follows:

Communication with Host (Port 1 - Dynamic):

If your private network contains a DHCP server supplying addresses to machines connected to the switch (perhaps built into the switch/router), then you can select this option for automatic configuration.

Communication with Host (Port 1 - Static):

IP Address: 192.168.1.x (make sure 'x' is set to a number between 1-255 and not already used in your network)
Subnet mask: 255.255.255.0 (resulting subnet: 192.168.1.0)
Gateway: 0.0.0.0
DNS server: 0.0.0.0

Communication with additional RT device (Port 2 - Static):

IP Address: 10.0.0.1
Subnet mask: 255.255.255.0 (resulting subnet: 10.0.0.0)

Then, configure your additional RT device (FPGA), like so:

Additional RT device (Static):

IP Address: 10.0.0.2
Subnet mask: 255.255.255.0

Hope this helps!
0 Kudos
Message 4 of 4
(5,583 Views)