User Tools

Site Tools


kb:ni-rt:linuxrt:set-ip-addr

90 Set IP-Address of Remote Systems

In the rare case of a not reachable remote system, the most likely cause are misconfigured IP-settings. If the IP-configuration gets lost, the controller uses default settings with a link-local address on Eth0. The link-local address isn't reachable from the normal subnet (e.g. 192.168.201.0). Because the VPN-connection doesn't support UDP-Broadcasts the MAX can't find and reconfigure the remote system.

Possible Solutions

Locally via Bash

On every remote system with a GUI it's possible to change the IP-configuration locally from the command line (“Bash”).

On the middle bottom of the Linux-RT Desktop is a symbol to start a bash shell. From the start directory navigate to the NI configuration directory.

$ cd /etc/natinst/share

The file with the IP-configuration is the ni-rt.ini. Before editing the config-file it's best practice to make a backup copy of the file. The sudo command is needed because the local user lvuser has no access rights to thees folders, root is needed.

$ sudo cp ni-rt.ini ni-rt.ini.bak

Edit the config file with vi (always installed) or nano (optional). The config file is divided in sections, we need to edit only the section ETH0 for the first network adapter. Enter the new static IP-address in the line IP_Address and disable the DHCP-configuration and link-local address by setting a “0” to the lines dhcpenabled and linklocalenabled. Here is a valid example for the ETH0 section which sets a static IP-address to 192.168.201.1.

$ sudo vi ni-rt.ini
 
...
 
[ETH0]
dhcpipaddr=192.168.1.180
llipaddr=169.254.71.37
dhcpenabled=0
linklocalenabled=0
IP_Address=192.168.201.3
Subnet_Mask=255.255.255.0
Mode=TCPIP
MediaMode=Auto
 
...

From another controller in the network

If there is another, reachable remote controller in the same target network, it's possible to run a small program on this controller which detects all other systems in this same network with a UDP-broadcast. There is a simple program “Find cRIO” for this purpose in the “HSE-Labs/hse-little-helpers” repository.

This program also contains functions for setting the IP-address via the NI-system-configuration API. However, this function didn't work in the last tests.

The “Find cRIO” program should return the IPv4-address, MAC-address and hostname of all systems in the network. Sometimes it returns a IPv6-address instead of the IPv4-address. That's the best case because with IPv6 it's possile to connect to the system via SSH. If the program returns only a IPv4 and the hostname, one can try to ping the hostname with the IPv6-option to get a IPv6-address.

$ ping -6 hostname.local

Logged in on the working system via SSH it's now possible to establish a second SSH-connection from here to the not working system. Use the hostname with the -6 option or direct the IPv6-address with SSH.

$ ssh -6 admin@hostname.local
 
or
 
$ ssh admin@fe80::280:2fff:fe16:5198

Then one can edit the ni-rt.ini-file like described in the sectione above.

It can happen that the System-Configuration Protocol returns a IPv6-address for a controller. In such a case it's possible to login via SSH and the IPv6-address.

If the IPv6-address starts with fe80:: then it is a link-local address like 127.0.0.1 for IPv4 and SSH doesn't connect with an error message “Invalid argument”. That's because SSH thinks the address is from the local machine, but the address doesn't exist on the local machine. In this case it can help to specify the Ethernet adapter SSH should use. The name of the adapter is appended to the address with an “%”.

$ ssh -6 admin@fe80::280:2fff:fe16:5198%eth0
kb/ni-rt/linuxrt/set-ip-addr.txt · Last modified: 2021/01/21 12:38 by manuel.sebald