Advertisement

change local IP adress programatically

Started by November 22, 2005 03:20 PM
3 comments, last by Marius 19 years, 3 months ago
I have this task. I connect to 192.168.0.X from a telnet client to a small server app listerning on port 21. I send a command string and instruct the app to change the local ip from 192.168.0X to a predefine one which dos not exist in the subnet and will be unique for that machine I am connecting to. I found how to do it fo windows NT HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCardsbut I cannot do it on Window XP. Thanks.
MCO
Just for the record, you probably ought not be touching those settings, even if the OS lets you.

You could seriously fubar a network configuration, and quite easily drop the machine off the local network assuming it has any routing or security policies in place. You will need (or should need) admin access on the box to make those changes.

frob.
Advertisement
Saying you shouldnt mess with IP addresses is a bit melodramatic.

WMI solution: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__computer_hardware.asp

IP Helper solution: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/addipaddress.asp

Enumerating the registry is a pain, plus it does not immediately change the config.

Thank you for http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/addipaddress.asp
Really helped a lot.


Marius C.

MCO

This topic is closed to new replies.

Advertisement