Solved

use netsh to reset the default gateway?

Posted on 2011-03-25
6
1,912 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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 69

Accepted Solution

by:
Qlemo earned 125 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
Network ports are the threads that hold network communication together. They are an essential part of networking that can be easily ignore or misunderstood, my goals is to show those who don't have a strong network foundation how network ports opera…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

776 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