views:

124

answers:

3

I am trying to add a new IP address to a local network adapter in Windows using the Windows API. Are there functions to do this in the Windows API, and if so, what are they?

I am not trying to create virtual network adapters, but simply trying to assign multiple IP addresses to the same adapter.

+2  A: 

Take a look at AddIPAddress and DeleteIPAddress.

nbolton
A: 

See AddIpAddress in the IP Helper library

tyranid
A: 

include iphlpapi.h and function to use:

"""

ULONG NTEContext = 0;
ULONG NTEInstance = 0;
DWORD status;

status = AddIPAddress (ipadd,
               netmask,
               index,
               &NTEContext,
               &NTEInstance);

"""

index is network adapter index.

chezgi