开发者

How to add an IP address to an existing network adapter in Windows?

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.


Take a look at AddIPAddress and DeleteIPAddress.


See AddIpAddress in the IP Helper library


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜