Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Programmatically change IP address in 9x/NT with no reboot

Posted on 2001-07-10
Medium Priority
Last Modified: 2012-06-27

I would like to alter the IP address of a network card using Visual C++ without having to do a reboot.

I have found some settings in registry but these seem to require a reboot for them to take effect.

I have also found IP helper commands to do the above, but this only works for windows 2000 and onwards. This needs to work on 95/98/ME/NT4/NT2000.

Can anyone help?
Question by:fel080497
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
LVL 32

Expert Comment

ID: 6268685
This cannot be done without a reboot.  Windows 9x has no facility to accomplish this either via an API or via undocumented "tricks".

It is possible to accomplish this for NT4 using an undocumented API call to DchpNotifyConfigChange() in the DHCP DLL but this doesn't exist on Win9x.

Expert Comment

ID: 6268733
I also know that this cannot be done in Win9x without a reboot. The same is true for DNS changes or other things like that. Changing IP without rebooting only exists in Win2K :)
LVL 32

Expert Comment

ID: 6269215
>>The same is true for DNS changes...

No, the same is NOT true for DNS.  The DNS address can be changed at any time and the new value will be immediately used.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


Expert Comment

ID: 6269708
We use WinIPCFG to hot swap between 2 networks on Win98.

One network is on 192.168.0.xxx
the other is on 192.168.1.xxx

Both networks have a DHCP server

Using WinIPCFG we can unplug the cable from the network card and plug in a cable connected to the other network.

We then do release and renew with WinIPCFG and it gets a new IP address from the DHCP server on the network.

This is cleary changing IP addresses without a reboot.

LVL 32

Expert Comment

ID: 6269880
>>This is cleary changing IP addresses without a reboot.

Not really.  I believe this question is about changing STATIC IP addresses which is not the same as renewing DHCP addresses.

Author Comment

ID: 6271403
Yes, I to have used WinIPcfg and ipconfig to renew DHCP addresses. But what I need is to be able to change static IP addresses.

So just what is the difference between DHCP changing the IP address and changing a static IP address. SUrely if DHCP can do it, then so can we!

Perhaps I dont understand the difference between the two?
LVL 32

Expert Comment

ID: 6271470
For whatever reason, the way Microsoft designed the TCPIP stack in Win95, 98, and ME, it CANNOT change from one static IP to another, from DHCP to static, or from static to DHCP without a reboot.  It simply cannot be done.

There is no technical reason why it could not be designed to be possible as NT4 and Win2000 prove.

DHCP is handled differently in the driver and needs to reboot.

Expert Comment

ID: 6272586
>>So just what is the difference between DHCP changing the
>>IP address and changing a static IP address.
>> SUrely if DHCP can do it, then so can we!

I guess DHCP is built around the idea of renewal and that it would need to support the possibility that an IP address could change.

Maybe MS just got lazy in this case and found that the static and dynamic portions of the 9x stacks were incompatible?  (maybe written by different teams?)

Maybe their is a very good 9x reason for it - who knows?


Author Comment

ID: 6274704
Hmmm, thank you microsoft is all I can say!!

This may sound a bit wacky, but do you know if a mini DHCP server could be written to run on the machines that is having the IP address changed. So that when they request a new IP address this responds with the new IP address which is then assigned using DHCP? Then in theory you could swap between two fixed addresses.

Can you run a DHCP server on the same machine that is requesting a new IP address? and is there a way of making the machine goto its own specific DHCP server?

Otherwise it looks like an upgrade to win2000 will have to be done in order to have this funcionality. (Nice one microsoft)
LVL 32

Accepted Solution

jhance earned 800 total points
ID: 6274799

In answer to your question, yes that certainly could be done.  I think the best approach is to implement an NDIS Intermediate driver (which goes between the top of the NDIS network card driver and below the transport drivers like TCPIP) and has access to all of the network traffic on the machine.  In essence a packet filter.  It would watch for a DHCP request, answer it itself, and could then configure whatever it wanted to configure on the local machine.

It's certainly not an impossible job but it's enough work that you're going to need a good reason for doing it.

Author Comment

ID: 6276283
Oh well thanks for answering, it may not have been the answer I was looking for but at least it confirmed my suspicions.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question