Help : Renew IP

Status
Not open for further replies.

AshishSharma

Livin' in the ghetto
Hi Guys,

I've recently shifted to Reliance Broadband (Wimax) while the connection is good, getting connected is pain. It's nearly impossible to get the IP from their DHCP server on first connect and you have to do Ipconfig /renew for at least 15 - 20 minutes to get the IP. The worst part is to have to sit in front of the laptop doing ipconfig /renew again and again. Now while I bug the Reliance guys to fix this issue, I am trying to workaround it or atleast reduce the pain involved.

I hence though of scripting the IP renewal process, I did found a script which is close to what I need but then I've Vista and this script seems to be not completely for Vista. Here's the script:

@echo off
::
:: IPREPAIR.CMD - Attempt to repair the network connections
::
:: Written 12/16/03 by Rick Campbell
::

:: Determine what OS this script is running on.
if not "%OS%"=="Windows_NT" goto :end
ver | find "[Version 5" || goto :end

:: Clear environment variables
set dhcp=

:: Determine if client is dynamically or statically assigned an IP address
echo Determining if client is DHCP based...
for /f "tokens=3 delims= " %%d in (
''netsh int ip sh add ^| find /i "DHCP"''
) do (
set dhcp=%%d
)

:: If client is dynamic, then release and renew the IP address
if /i "%dhcp%"=="Yes" (
echo Client is using DHCP - Renewing the DHCP Address lease...
ipconfig /release > nul
ipconfig /renew > nul
) else (
echo Client is statically assigned - leaving address untouched...
)

:: Flush the ARP, NetBIOS, and DNS cache''s
echo Flushing the ARP Cache...
arp -d * > nul
echo Flushing the NetBIOS Cache...
nbtstat -R > nul
echo Flushing the DNS Cache...
ipconfig /flushdns > nul

:: Re-register the NetBIOS and Computer names with WINS and DNS
echo Re-registering the NetBIOS and Computer name with WINS and DNS...
nbtstat -RR > nul
ipconfig /registerdns > nul

goto :eof

:END
echo This script is to be run on Windows 2000/XP/2003 Only!



Can anyone help me alter this script for Windows Vista, also I am quite possibly doing it all wrong so if you have some suggestion on how to get this done. If there's some tool which should help me do this easily.

Most importantly the script should also check that it's not getting APIPA as the DHCP server tends to be unreachable for first couple of attempts.

~ Bump ~

Nobody here to help ?
 
Last edited:

scorpio.in

Right off the assembly line
Thanks man..i also have the same problem with reliance wimax. I've an xp system and i'll try this.
 

[xubz]

"The Cake is a Lie!!"
Hey, I don't use vista, But I can help.

Can you run these commands and post them here?

ver
echo %OS%

And yeh, edit the post and put the script in
Code:
 tags :)


Edit: Try this (You may need to run it as Admin)
[code]
@echo off
::
:: IPREPAIR.CMD - Attempt to repair the network connections
::
:: Written 12/16/03 by Rick Campbell
::

:: Determine what OS this script is running on.
if not "%OS%"=="Windows_NT" goto :end
ver | find "[Version 6" || goto :end

:: Clear environment variables
set dhcp=

:: Determine if client is dynamically or statically assigned an IP address
echo Determining if client is DHCP based...
for /f "tokens=3 delims= " %%d in (
''netsh int ip sh add ^| find /i "DHCP"''
) do (
set dhcp=%%d
)

:: If client is dynamic, then release and renew the IP address
if /i "%dhcp%"=="Yes" (
echo Client is using DHCP - Renewing the DHCP Address lease...
ipconfig /release > nul
ipconfig /renew > nul
) else (
echo Client is statically assigned - leaving address untouched...
)

:: Flush the ARP, NetBIOS, and DNS cache''s
echo Flushing the ARP Cache...
arp -d * > nul
echo Flushing the NetBIOS Cache...
nbtstat -R > nul
echo Flushing the DNS Cache...
ipconfig /flushdns > nul

:: Re-register the NetBIOS and Computer names with WINS and DNS
echo Re-registering the NetBIOS and Computer name with WINS and DNS...
nbtstat -RR > nul
ipconfig /registerdns > nul

goto :eof

:END
echo This script is to be run on Windows 2000/XP/2003 Only!
 
OP
AshishSharma

AshishSharma

Livin' in the ghetto
Thanks for helping me out with this issue guys.

I tried your modified script and got the following response :

On the command prompt :
__________________________________________________
C:\Users\sharashi\Desktop>renew-1.bat >output.txt
''netsh' is not recognized as an internal or external command,
operable program or batch file.
The ARP entry deletion failed: 87
__________________________________________________

In the output.txt file :
_____________________________________________
Microsoft Windows [Version 6.0.6000]
Determining if client is DHCP based...
Client is statically assigned - leaving address untouched...
Flushing the ARP Cache...
Flushing the NetBIOS Cache...
Flushing the DNS Cache...
Re-registering the NetBIOS and Computer name with WINS and DNS...
_________________________________________________
For the ver echo %OS% command I get the following output:

C:\Users\sharashi>ver echo %OS%

Microsoft Windows [Version 6.0.6000]

Hope this could take us somewhere :)
 
Status
Not open for further replies.
Top Bottom