[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

use netsh to reset the default gateway?

Posted on 2011-03-25
6
Medium Priority
?
2,194 Views
Last Modified: 2012-06-21
I am using the following command in an automated rerouting script.

     netsh interface ip set address name="Local Area Connection" gateway=172.20.2.252 gwmetric=0

 To restore the route, I want to return the interface to full DHCP, and  I use:

    netsh interface ip set address name="Local Area Connection" source= dhcp

The interface changes back to dhcp, but the default gateway does not change back to the dhcp value. If you open the network connections TCP/IP properties, the interface is set to DHCP, but there is a "ghost" value in the default gateway box. I want to clear all values and let DHCP restore them.

0
Comment
Question by:HilltownHealthCenter
6 Comments
 
LVL 9

Expert Comment

by:rsoly777
ID: 35219114
did you try this? netsh interface ipv4 set address name=”Local Area Connection” source=dhcp
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 35219117
Just a guess:

ipconfig /renew

wmp
0
 

Expert Comment

by:tlecso
ID: 35219142
First, remove TCP/IP  service from Local Area Connection. Then add it back and maybe it works. If this method does not work, remove your Network Card and re-install it.
0
Industry Leaders: 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!

 
LVL 9

Expert Comment

by:rsoly777
ID: 35219212
Unfortunately I don't think your script would uninstall and re-install the NIC card every time it may be possible to script the ipconfig/renew.
Maybe: http://www.emergingtechs.com/posts/create-batch-file-easily-refresh-network-settings/
http://msdn.microsoft.com/en-us/library/aa394595%28v=vs.85%29.aspx
http://www.visualbasicscript.com/renew-IP-address-in-login-script-m25435.aspx

All these have possibilities but just depends on what type of script you are running

0
 
LVL 14

Expert Comment

by:Don Thomson
ID: 35230572
Have you tried -

 netsh interface ip set address name="Local Area Connection" source= dhcp
ipconfig /release
ipconfig /renew
0
 
LVL 71

Accepted Solution

by:
Qlemo earned 500 total points
ID: 35234327
Seems as your DHCP server does not provide a default gateway. Try to reset it prior to switching to DHCP:
netsh interface ip set address name="Local Area Connection" gateway=none
netsh interface ip set address name="Local Area Connection" source=dhcp
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month19 days, 3 hours left to enroll

834 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