Example Code

Find Available IP Addresses on a Subnet

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

Code and Documents

Attachment

Overview: This example automates the task of sequentially pinging multiple IP addresses on a given subnet to determine which IP addresses are available.


Description: When adding a device to a network, you must often choose an IP address for the device. The method you use to obtain an IP address may depend on whether you have a network with an administrator or not. If you have a network with an administrator, it is best to consult with the administrator to choose an appropriate IP address for the device. If your network does not have an administrator, or it is necessary to find an available address on your own, you can use this VI to determine which IP addresses on a subnet are available for use. This example automates the task of sequentially pinging multiple IP addresses on a given subnet to determine which IP addresses are available. The pinged IP addresses are added to a table along with their availibility status.


Requirements: LabVIEW 2012 (or compatible). Hardware: network adapter with connection.


Steps to Implement or Execute Code:

1. Enter an IP Address that resides on the subnet you wish to search.

2. Enter the subnet mask for the subnet.

3. Run the VI.

4. Status Table will be updated with the pinged IP addresses and their availability.


Additional Information or References: 

 

Find Available IP Addresses on a Subnet LV2012 NI Verified FP.png

 

Find Available IP Addresses on a Subnet LV2012 NI Verified BD.png


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

 

John Passiak

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