Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is a batch file the only way to release and renew an IP in one step?

ipconfig /release
ipconfig /renew

I unfortunately have to admin some Windows servers using Remote Desktop. Obviously if I type ipconfig /release, then I'll loose my connection and won't be able to ipconfig /renew. Obviously this can be done with .bat files, but I wanted to ask the pros just to see if there were any other tricks to doing it in the Windows server world.

share|improve this question
    
The 'pros' would look to have an out-of-band remote management solution such as HP Integrated Lights Out or Dell's DRAC system in place. It then doesn't matter if the main network interfaces are functional with a correct IP address or not, you can still remote control the server to get them changed and working again. –  SteveBurkett Jun 25 '10 at 11:33
add comment

3 Answers

up vote 7 down vote accepted

Most people I think just either use static IP addresses for servers, or fixed DHCP assignments, and don't change IP addresses outside of scheduled reboots (Changing endpoints on running servers=bad). A bat file seems the simplest solution, but honestly even a straight up release should autorenew an IP address before the remote desktop session times out.

share|improve this answer
    
in agreement, sounds odd to have renew the ip address of a server- it is generally not recommended. –  redknight Jun 24 '10 at 17:57
1  
+1 DHCP on a server is not recommended at all, but I'd go with a right-click Repair on the NIC properties in the systray; that should work too and on a remote workstation I just tried, my RDP session persisted without issue. –  gravyface Jun 24 '10 at 17:58
1  
I'm in the process of switching the server from a fixed address to a static DHCP lease on a new DHCP server. That's why I need to release/renew it, so it picks up its static lease from the new DHCP server. –  Jakobud Jun 24 '10 at 17:58
    
When you set it to DHCP it should auto renew? It certainly shouldn't need to release (what would it even be bound to?). –  yasth Jun 24 '10 at 18:01
    
Agreed that this, in general, is not something you would want to do... but when setting up the machine to use a static IP in the first place, while remoted in? It just saved my bacon. –  mmc Feb 3 '13 at 20:55
add comment

Use AT command. Example AT 12:58 ipconfig /release

AT 12:59 ipconfig /renew (this is useful when connecting with psexec, because it does not handle && commands)

share|improve this answer
add comment

Combine the two commands into one

ipconfig /release && ipconfig /renew

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.