Add extra IP Address instead of change the existing one

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi everyone, this is my first post.


So the plan is to develop a system that will utilize a Virtual IP to achieve some extend of redundancy or hot backup. Im currently trying to develop a small test program that can add another IP address to my one and only Ethernet interface.


Ive seen several example showing how to utilize System.Management; ManagementBaseObject to change the existing setting to a static address:

ManagementBaseObject setIP;
ManagementBaseObject newIP = objMO.GetMethodParameters("EnableStatic");

newIP["IPAddress"] = new string[] { ip_address };
newIP["SubnetMask"] = new string[] { subnet_mask };

setIP = objMO.InvokeMethod("EnableStatic", newIP, null);
But how do I ADD another IP address? Is it possible? To achieve the same effect as:

netsh interface ipv4 add address "Local Area Connection" 10.0.0.2 255.0.0.0

THANKS ALOT.

View the full article
 
Back
Top