NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign multiple IP addresses to one Ethernet port on cRIO

Solved!
Go to solution

Hi guys

I try to assign multiple IP addresses to one of my Linux based cRIO-9067 Ethernet ports.

I where able to do this temporally by using PuTTY and the following command (ip addr add [ip]/[mask-digits] dev [nic] => Example "ip addr add 10.112.1.65/24 dev eth0") But after rebooting the system everything is lost as has to be configured again.

I found several Links which for doing this permanent. They describe to edit "/etc/sysconfig/network-scripts" or "/etc/network/interfaces". Network-scripts I haven't found on the cRIO target. The interfaces file can be found and edited. I tried already different command but without any results.

How to assign multiple IP addresses to one network interface
http://xmodulo.com/how-to-assign-multiple-ip-addresses-to-one-network-interface-on-centos.html

Add a secondary IP to Linux
https://www.garron.me/en/linux/add-secondary-ip-linux.html

How can I (from CLI) assign multiple IP addresses to one interface?
http://askubuntu.com/questions/547289/how-can-i-from-cli-assign-multiple-ip-addresses-to-one-interfa...

  • Has someone already done something in this style?
  • Is there another file I have to edit?
  • Is it possible to store somewhere a batch file (something similar) which runs the commands as administrator? (With System Exec.vi I haven't the permission to do this.)

It would be great to get there some help.

Many Thanks.

Andreas

Kind regards,
Andreas
0 Kudos
Message 1 of 8
(7,311 Views)
Solution
Accepted by topic author SAndreas

A.Scheuber wrote:

I found several Links which for doing this permanent. They describe to edit "/etc/sysconfig/network-scripts" or "/etc/network/interfaces". Network-scripts I haven't found on the cRIO target. The interfaces file can be found and edited. I tried already different command but without any results.

Your controller uses ifplugd, not the traditional networking infrastructure as used by Debian or Red Hat based distributions.

Has someone already done something in this style?

IIRC, no. And I could imagine there are good reasons why. Outside of IPv4LL, very few networks route multiple IP subnets over the same layer 2 network. In particular, VLANs offer much better partitioning.

Is there another file I have to edit?

You will want to edit /etc/ifplugd/ifplugd.action which is a symlink to /etc/natinst/networking/ifplugd.script, such that

  • `ip addr add` gets run when eth0 is up
  • `ip addr del` gets run when eth0 goes down

Just to make this clear: any errors in your changes will break ALL networking on the controller. On the bright side, the changes don't affect safemode, so if something bad happens, and you're not connected over serial console, you can always force reboot into safe mode (holding the reset button down), ssh back in, and fix the script.

0 Kudos
Message 2 of 8
(6,755 Views)

Hi Richard

Many Thanks for your replay.

You where right by editing the ifplugd.action file. (And thanks for the tip with safemode).

If there are other who needs something similar I created very step by step Tutorial and

a LabVIEW sample project to test it later. They are attached to this post.

Thanks

Andreas

Kind regards,
Andreas
0 Kudos
Message 3 of 8
(6,755 Views)

Thanks Andreas and Richard, this worked perfectly!

0 Kudos
Message 4 of 8
(6,755 Views)

I followed the instructions on two cRIO-9035. it worked on one but not the other.  as noted, this broke the network connectivity on the 2nd cRIO.  I tried to modify the file /etc/ifplugd/ifplugd.action by booting into safe mode, but its content did not show my changes.  it seems that safemode moved the orginal file to another place and replaced the file with its own, then upon booting back into normal mode, the original file was moved back. 

 

where could the original files be in safe mode?

 

thanks!

 

0 Kudos
Message 5 of 8
(6,670 Views)

The filesystem partition used in run mode (the normal execution mode) is mounted at /mnt/userfs while the target is booted into safe mode.

 

For this particular case there is also the complication that the 'ifplugd.action' file is a symbolic link to another file:

# ls -l /etc/ifplugd/ifplugd.action
lrwxrwxrwx 1 admin administ 38 Jun 9 2016 /etc/ifplugd/ifplugd.action -> /etc/natinst/networking/ifplugd.script

 

Putting these two pieces of information together the file you want to edit while in safe mode is at:

/mnt/userfs/etc/natinst/networking/ifplugd.script

 

Message 6 of 8
(6,663 Views)

Thank you very much for the information, Crisan!

 

0 Kudos
Message 7 of 8
(6,652 Views)

Hi rtollert,

How do VLANs work with a cRIO? Is it possible to have multiple VLANs assigned to one cRIO port?

0 Kudos
Message 8 of 8
(6,595 Views)