Link to home
Start Free TrialLog in
Avatar of fel080497
fel080497

asked on

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

Hi

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?
Avatar of jhance
jhance

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.
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 :)
>>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.
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.

Regards,
Mike.
>>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.
Avatar of fel080497

ASKER

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?
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.
>>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?

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)
ASKER CERTIFIED SOLUTION
Avatar of jhance
jhance

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh well thanks for answering, it may not have been the answer I was looking for but at least it confirmed my suspicions.