NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Switch from static to dynamic IP on secondary NIC without restart?

This should be doable on Linux RT targets I guess (even on the primary NIC then too), but is there a way NI would recommend doing it?

Normally I use the System Configuration API to change these things, but if I wanted to do it on the fly like this I guess I would need to do it under the hood instead, or?

0 Kudos
Message 1 of 18
(6,829 Views)

The System Configuration API allows you to change the NIC configuration without a reboot on Linux RT targets, so no need to make changes under the hood.

change secondary.png

__________________
Daniel Jaramillo
National Instruments
0 Kudos
Message 2 of 18
(3,927 Views)

Thanks for the reply.

One thing I noticed about this was that I seemingly had to do a reset after all...until I found out that the reason I can still access the old IP after a change here, is that the ARP lookup table still directs the old IP to the correct MAC address. It does not get refreshed.

-  If I disconnect the device from the network then reconnect it, the ARP tables are updated and the new IP works. So no restart of the Linux target, but I now need to manually unplug and plug the NIC to refresh of the ARP cache.That's not an acceptable requirement(!)... If the configuration is updated the NIC should automatically go off- then online again at least - to initiate an ARP update, should it not? What is missing

I tried doing the change with the system config API in two steps, where I disable the interfasce first, then reenable it. Hoping that this would force a refresh, but that does not cut it...

0 Kudos
Message 3 of 18
(3,927 Views)

http://www.ducea.com/2009/03/06/howto-force-remote-devices-routersswitches-to-refresh-their-arp-cach...

I guess this is the same issue...and the solution should be that the network card enforces an ARP update...but how can we get that done, is it doable from the System Configuration API?

0 Kudos
Message 4 of 18
(3,927 Views)

Just to be clear, are you referring to the ARP tables on the RT target or on the host? After you modify the secondary NIC configuration, are you trying to connect to the target from the host using that NIC? It would help if you can tell me a bit more about your system configuration network layout.

The System Configuration API does not provide a way to do an ARP update. A workaround would be to use LV system exec VI to run a command on the target that does what you need.

__________________
Daniel Jaramillo
National Instruments
0 Kudos
Message 5 of 18
(3,927 Views)

The problem is that the RT target does not indicate in any way to the network that it has changed its configuration, so none of the "hosts" will update their ARP tables. Or as stated in a comment to the document I  inked to earlier:

"However, a PROPER network driver will issue a Gratuitous ARP REPLY every time the interface goes up/down or every time the IP address is changed. This will update all ARP tables in all switches automatically. So no special actions are needed."

0 Kudos
Message 6 of 18
(3,927 Views)

The arping command is not available on Linux RT, so using that to issue a gratuitous ARP is not possible (?).

It seems I can force things by using "ip link set eth1 down", then "ip link set eth1 up" from an admin session, but I cannot run that using System Exec due to the limited access of the LabVIEW application.

0 Kudos
Message 7 of 18
(3,927 Views)

Without other suggestions available yet I tried to log on as admin from system exec to be able to run the ip link up/down commands...But if I run "ssh admin@localhost" for example I run into this message:

"Pseudo-terminal will not be allocated because stdin is not a terminal.

Host key verification failed."

I've found some suggestions on Linux sites on how to get passed this, but no luck so far.

0 Kudos
Message 8 of 18
(3,927 Views)

If you're already on the right device, you don't need ssh. ssh is good for remote access from one device to another. If you just want to change users, the command to consider is "su": http://man7.org/linux/man-pages/man1/su.1.html

0 Kudos
Message 9 of 18
(3,927 Views)

When changing IP settings, we do an ifconfig  down/up. I tried setting a static IP on a 9068 and didn't see an ARP broadcast. However I was able to ping the target on the static IP.

Also arping is available at http://download.ni.com/ni-linux-rt/feeds/2014/arm/armv7a-vfp-neon/iputils-arping_s20101006-r6_armv7a...

You can try add an arping call to /etc/ifplugd/ifplugd.action on the up case, or even run it as a daemon on the target.

Message 10 of 18
(3,927 Views)