How to add IPs

G

Guest

Hi everyone,

Thanks for reading and for any assistance, I hope I posted in the right place.

I am trying to find a method in which to add / remove IPs from a network
card. I am going to be placing this into a web service in which - on the fly
- i will be adding and/or removing an IP address from the NIC card on the
win2k3 server.

I would prefer to use c# in dot net 1.1, although vb is ok as well. Any
help or guidance would be much appreciated.

Thanks!
 
M

Michael Nemtsev

Hello A.Taheri,

Use WMI and class "Win32_NetworkAdapterConfiguration"
Sample for chaning network card settings is there http://www.thecodeproject.com/csharp/OazSwitchNetConfig.asp

A> Hi everyone,
A>
A> Thanks for reading and for any assistance, I hope I posted in the
A> right place.
A>
A> I am trying to find a method in which to add / remove IPs from a
A> network card. I am going to be placing this into a web service in
A> which - on the fly - i will be adding and/or removing an IP address
A> from the NIC card on the win2k3 server.
A>
A> I would prefer to use c# in dot net 1.1, although vb is ok as well.
A> Any help or guidance would be much appreciated.
A>
A> Thanks!
A>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
G

Guest

Hi,

Thanks for that - I tried this one and it seems like it changes the network
settings - I simply need to add another IP rather then replace the IP like
this script does - any guidance for that part?
 
G

Gabriel Magaña

Doesn't the "public static void SetIP()" function in the referenced article
allow you to add IP addresses? One of the parameters is a comma-delimited
list of IP addresses...
 
G

Guest

Hi,

yeah I noticed that shortly after posting.

But when I run it in the following way:
SetIP("00:11:D8:8E:34:59", "10.10.10.10,50.50.50.50,51.51.51.51",
"255.0.0.0", "10.10.10.10", "10.10.10.10,50.50.50.50");

I modified it to match the Mac address instead of the previous method since
the system is multi homed and I only want it added to a certain nic card.

It runs correctly and does not error at all, but the system does not update
and the info passed does not take effect.

Any idea why?
 
G

Guest

if it helps I found the retrun values of the following:

setIP["returnValue"] = 90
setGateways["returnValue"] = 0
setDNS["returnValue"] = 0

From what I understand 0 is good, anything else is not soo good, but I cant
really find anywhere that explains what these mean either :(

Am I wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top