NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

sbrio-9627 vlan setup

Hi,

 

I was wondering if anyone has setup the sbrio-9627 with interal Vlan tagging?

 

To tag for eksempel two different TCP ports with different vlans for network segregation?

 

Regards

 

Mrmas

0 Kudos
Message 1 of 2
(2,711 Views)

Hello Mrmas,

 

Yes, for the first part of your question, I did so. As the sbRIO-9627 is a Linux device, it's possible using standard Linux commands, and including it into some of the NI scripts used to automate the network set-up. This is what I did (there might be better ways, especially extending to hide the VLAN(s) from NI MAX which does not support VLANs):

 

I ssh'ed into my sbRIO and used opkg list-installed | grep vlan to check that the vlan support package is already installed.

 

Then I did this to set up a VLAN temporarily without changing config files. In case I locked myself out I could simply have rebooted the device to load the previous configuration letting me in again.

  1. ip link add link eth0 name eth0.123 type vlan id 123 (to add then virtual VLAN interface)
  2. ip addr add 192.168.4.15/8 dev eth0.123 (to bind an IP address to the VLAN interface)
  3. ifconfig eth0.123 up (to enable the new interface)
  4. ip link show (to see and check the configuration).
  5. Then I used external devices to check this. More VLANs can be added ad-lib.

 

Afterwards, I implemented this into the configuration files:

  1. vi /etc/natinst/networking/ifplugd.script (to start editing the configuration file that sets up the network interface(s) every time a cable is (un)pluggged)
  2. Add these lines:
    putty_2018-09-04_16-13-40.png
  3. To check the configuration, reboot the device. Afterwards, unplug the Ethernet cable, wait 5 seconds, plug it in again. Wait 5 seconds. Now execute ip addr list and you should be able to see an entry for eth0.123@eth0 that has something like UP or LOWER_UP, and state UP in the first line, and the IP address you assigned nearby.

Please be aware of these caveats of this approach:

  • I have not tested EtherCAT with this. Although EtherCAT is based on Ethernet, there might be issues when setting the raw-interface Ethernet port (e.g. eth0 for your eth0:123 vlan) to EtherCAT mode.
  • VLANs are not supported by NI MAX. The new virtual interface (e.g. eth0.123) might show up on the Network Settings tab of your sbRIO in NI MAX. NI MAX does not realize it is a virtual interface and show the configuration of eth0 instead. Changing (and saving it to the device) might bring the IP configuration into a state where NI MAX is not capable of interpreting it meaningful anymore. Check ni-rt.ini in case you tried this out.

 

 

Regarding the second part of your question, defining a VLAN id per TCP port: I have not tried this. As TCP ports are on OSI model layer 5 whereas VLAN tagging is Ethernet (= Level 2), you need additional configuration to reach this goal. I am sure it will work using the normal Linux tools. I personally would implement this using firewall rules with iptables, allowing only strictly defined routes.


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
Message 2 of 2
(2,623 Views)