Example Code

Programmatically Change IP Address Of Remote System

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW Real-Time Module
  • LabVIEW

Code and Documents

Attachment

 

Overview

This example shows how to programmatically change the IP address of a remote system。

 

Description

This code shows how to programmatically change the IP address of a remote system.

 

To implement this function, firstly get FTP file where host is the original IP address and remote path is the file ni-rt.ini that needs to be changed and open the .ini file. Then read the whole file, looking for "IP address =" in the file and looking for "S" (which is the start of the next item in the file i.e Subnet..). Everything in between these is the IP Address that we are interested in. Next add the new IP address into the file, replace /open the file with the same path and wirte the new content. Lastly copy .ini file on local machine and reboot the machine for changes to take effect.

 

Requirements

  • LabVIEW 2012 (or compatible)
  • Real Time Module 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Obtain the current IP address by doing an ftp://"ip address"/ from the .ini file and save it somewhere
    on your PC
  2. Use the LabVIEW program to set the path of the .ini file
  3. Set the new IP address on the front panel

 

 

Additional Information or References 

VI Snippet

2.png

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

 

Shalini B
Applications Engineer
National Instruments UK & Ireland

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.