Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to Add and Delete IP Addresses From a Program

2 views
Skip to first unread message

Tom Einertson

unread,
May 7, 2009, 11:31:53 PM5/7/09
to
I'm looking for a way to add and delete IP addresses on an ethernet
adapter dynamically using a program on Windows. That is to say I want
to assign a number of IP addresses to a single ethernet card and be
able to add and delete those IP addresses from a program.

I have found lots of web pages that describe how to add additional IP
addresses to an ethernet adapter using the TCP/IP properties of the
network applet in the Control Panel, but those are all manual
procedures. I'm looking for a way to do it from a program.

It appears that I can do this using the 'netsh' command, but that
command seems to depend on the Routing and Remote Access Service
(RRAS). Running RRAS just to allow the netsh command to work is kind
of like killing a fly with a sledgehammer. I suppose it will work, but
it seems like there ought to be an easier tool for the job.

My preference would be to do this via a C system call. Obviously such
a system call exists because ultimately the control panel applet and
netsh make some kind some kind of system call to do the actual work. I
assumed this might be done using an ioctlsocket or WSAIoctl call, but
none of the options for either of these functions seems to do the job.

Does anyone know an easier way to do this in Windows? I've searched
for hours and consulted every Windows networking book I have but so far
netsh is the only solution I have found.

--
Tom Einertson E-mail: tom.ei...@siemens.com
SIEMENS Power Transmission & Distribution Phone: (952) 607-2244
Energy Management & Automation Division Fax: (952) 607-2018
10900 Wayzata Boulevard, Suite 400
Minnetonka, MN, 55305


0 new messages