Question Non-persistent IP Addressse on Windows

agentgonzo

Grounded since '09
Addon Developer
Joined
Feb 8, 2008
Messages
1,649
Reaction score
4
Points
38
Location
Hampshire, UK
Website
orbiter.quorg.org
Does anyone know how to set up a static (but temporary) IP address on a windows machine (XP and 2003) that will be applied for as long as the machine is running, but be cleared on the next boot?
 
Aside from having an autostart that changes it, nothing else springs to mind right now.
 
Does anyone know how to set up a static (but temporary) IP address on a windows machine (XP and 2003) that will be applied for as long as the machine is running, but be cleared on the next boot?
If the computer's on a local network, look into setting up your router to assign the computer a static IP. If the computer's not on a local network, giving yourself a static IP will mean that you won't be able to access the internet, since your ISP has a DHCP server for a reason.

That said, try this: http://support.microsoft.com/kb/308199 . It's written for Windows 2000, but it should be a fairly similar process in XP or Vista.
 
Hielor, I think this was really more about having it reset or change once he reboots.
 
Well DHCP can handle this sort of. When a computer shuts down, the network should respond by taking the IP address back into the pool. Then when it powers up, it reassigns the address, sometimes the same, sometimes not to the machine. Typically, you can set a time limit on how long a device can hold an IP address.
 
Questions... if it is a non-routable IP (non-public) what does it matter? If it is a routable (public) IP then just force a release and renew of the IP via the DHCP service.
 
Also have a look at private managed IP addresses.

What, EXACTLY, do you want to achieve?
 
Cheers for the help folks. More of what I'm after:

We're not running DHCP (and can't for reasons that we need not get into).

We're running a massively complex and reconfigurable network (don't ask). I'm looking for an API call/application/method for assigning a specific IP address to a machine in such a way that it will be present on that machine (NIC) up until the machine reboots. The NICs will be running with more than one IP address aliased onto them. Upon reboot, we want it such that all the aliased IP addresses are no longer asssigned to the NIC (or computer) apart from the 'base' address. TSP got the right idea. There is no ISP or routing to worry about as it's a private network entirely under our control

I know that you can do this on linux with ifconfig, but need to do it on windows

---------- Post added at 21:59 ---------- Previous post was at 21:57 ----------


Static (as in not DHCP)
Temporary (as in it will only be there until power-off - ie, not persistant)
 
Last edited:
What you're asking for is a dynamic system other than DHCP. There is only dynamic and static that's it. BootP sounds like it would work, but it basically requires DHCP-style architecture.

If you're going with BootP, when configured, at Boot (hence the name) it will generate a broadcast "what is my address?" message that will be received by the BootP server which will generate a reply "your address is..." broadcast message. From what I understand, it can allow the machine to hold the address until it powers down whereupon boot up will restard the process all over again.

Though I'm curious as to why you can't run DHCP since BootP uses basically the same architecture.
I'm not sure if it would work, but at bootup, the machine might be able to execute a particular set of instructions that will assign itself a static IP address which of course would be inactive upon power down.
 
My XP is slightly slipstreamed. Somehow that tool must have been left out...
 
Use DHCP and reserve the IP address. That way, each client will get the same IP address each time.
 
If you're going with BootP, when configured, at Boot (hence the name) it will generate a broadcast "what is my address?" message that will be received by the BootP server which will generate a reply "your address is..." broadcast message. From what I understand, it can allow the machine to hold the address until it powers down whereupon boot up will restard the process all over again.
We're running this on about 1600 machines and the IP Addresses that need to be assigned are specific ones depending on the current configuration of the system (that can change up to four times a day). There are also on average about 4 IP Addresses assigned to the NIC, some need to be static and persistent. Some need to be non-persistent and last as long as the computer is powered on.

Though I'm curious as to why you can't run DHCP
Disallowed due to security constraints, and we're now far too far down the line of development/integration to change it if we wanted or were allowed to. There are other reasons too that I can't/won't get into.

We are currently using netsh to set it, but there is no option in netsh to make the ip address non-persistent. Having a script to run at shutdown to remove the IP addresses is all well and good, but on an unexpected powerdown, the IP addresses will not be removed (as the shutdown scripts will not run). Running them at startup does not work reliably enough if you already have IP address conflicts.

Use DHCP and reserve the IP address. That way, each client will get the same IP address each time.
I already said that we are not using DHCP. Also, we don't want the client to have the same IP addresses each time it boots up. The IP addresses (for reasons that I'm not getting into here) change each time it is reconfigured, with (generally) IP address being moved from machine to machine as the roles change.


In linux, if you change the ip address with ifconfig (to a static address) it will remain on there, working as normal, until the machine is rebooted (this may not happen on all the flavours, but I've definitely seen it on Suse). What I want to know is if this is possible with Windows. It is by far the simplest solution to the state that we're in.
 
Since you can activate and deactivate NICs in the GUI, I'd think that ought to be possible with console commands too. So if the default state is deactivated, your boot script sets the ip, enables and everything is fine. If you have uncontrolled shutdown it *should* revert to disabled. In my experience you can never be sure about this kind of behaviour.
Having a service that runs early on boot and does this would be prefered.
 
If you have uncontrolled shutdown it *should* revert to disabled. In my experience you can never be sure about this kind of behaviour.
No, it doesn't. It just leaves everything in the last state that it was configured to
Having a service that runs early on boot and does this would be prefered.
This is how we're doing it at the moment, but was wondering whether there was an easier way to do it (as there is in linux) without having to revert to services that aren't particularly reliable when windows is loading up and/or if there are already IP conflicts caused by machines booting with rogue IP addresses.
 
Back
Top