netIC configuration with FTP script [EN]

Configuration of the NIC 52-RE via FTP script

Please find the following Example attached to this Application Note:

Set IP address

To set the IP address of the netIC, the protocol "netIdent" can be used.

The netIdent protocol was developed by Hilscher for easy configuration of Hilscher devices with Ethernet interfaces.

To set the IP address only one UDP packet has to be send to the device.


Please have a look at this example:

Broadcast IP address: 255.255.255.255

PC UDP port: 25384

netIC UDP port: 25383

UDP Frame

Data (118 bytes)

IP address to be assigned to the netIC (C0 a8 01 0b = 192 168 1 11)

Serial number of the netIC (00 00 8c 82 = 35970)


ff ff ff ff ff ff c8 d3 ff e3 41 b1 08 00 45 00 00 92 fd 4f 00 00 80 11 00 00 c0 a8 01 0a ff ff ff ff 63 28 63 27 00 7e c2 41

48 49 4e 49 00 00 03 e8 00 00 00 03 00 00 00 01 00 00 20 7e 00 00 00 00 c0 a8 01 0a 00 00 63 28 c0 a8 01 0b 00

02 a2 4e cb a2 00 00 8c 82 00 00 10 38 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 ff ff ff 00


There are several possibilities to send TCP/UDP packets.

Please find below two command line examples for netcat and packetsender.

netcat

To send and receive udp packets you can use for example the Tool netcat:

For Linux and WSL:

echo -n -e "\x48\x49\x4e\x49\x00\x00\x03\xe8\x00\x00\x00\x03\x00\x00\x00\x01\x00\x00\x20\x7e\x00\x00\x00\x00\xc0\

xa8\x01\x0a\x00\x00\x63\x28\xc0\xa8\x01\x0b\x00\x02\xa2\x4e\xcb\xa2\x00\x00\x8c\x82\x00\x00\x10\x38\x00\x00\x00\

x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\

x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\

x00\x00\x00\x00\x00\xff\xff\xff\x00" | nc -u -w 1 –v -s 192.168.1.10 -p 25384 255.255.255.255 25383


The -n suppresses outputting the trailing newline

The -e enables the interpretation of backslash escapes → allowing to send hex codes


-u for UDP

-w 1 for close connection after 1second, depending on the netcat implementation -c (GNU), -q (OpenBSD) also possible

-v verbose

-s IP address of the NIC, only necessary if you have multiple NICs

-p bind to UDP port

For Windows https://nmap.org/ncat

echo <hex to ascii> | ncat -u -w 1 -v -s 192.168.1.10 -p 25384 255.255.255.255 25383


packetsender

To send and receive udp packets, for example the Tool packetsender can be used:

Packetsender can be used for Linux, Mac and Windows. https://packetsender.com/


packetsender -u -x -w 1000 -b 25384 255.255.255.255 25383 48494e49000003e800000003000000010000207e00000000c

0a8010a00006328c0a8010b0002a24ecba200008c8200001038000000000000000000000000000000000000000000000000

00000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff00


-u for UDP
-x for hex data
-w 1000 for close connection after 1second
-b bind to UDP port
The example command works only with one NIC

FTP Script

Prerequisits are:

  • Connection to the device via Ethernet port
  • FTP server active
  • IP address set in the netIC

Install WinSCP

In this example WinSCP is used as FTP client.

Please find the Download and more information at https://winscp.net/.

After the installation the WinSCP installation path must be added to the Windows environment variable PATH.

For example:

C:\Program Files (x86)\WinSCP

Create configuration data

Unfortunately, there is no possibility to create the configuration data directly.

The easiest way to create them is to configure the netIC with the netX Configuration Tool.

Once the netIC is configured, the required data can be downloaded via FTP (Filezilla or similar).

FTP files

*.nxf is the firmware file
*.nxd are the configuration files

In the path /SYSVOLUME/Port_1/sx/pub, the web server files are stored.

FTP Script

The example script "script_netIC.txt" consists of two commands

  • Open: Open session using open command.
  • Put: For uploads use put command.

For more information see https://winscp.net/eng/docs/guide_automation.

Calling the script

The script can be called via batch file. The script file is called with the following command:

winscp.com /ini=nul /script=script_netIC.txt


→  /ini=null to isolate the script execution from GUI configuration
→ /script command line option to pass the script tot he WinSCP executable.