Solved

use netsh to reset the default gateway?

Posted on 2011-03-25
6
1,886 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
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.

 
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 68

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

We have adopted the strategy to use Computers in Student Labs as the bulletin boards. The same target can be achieved by using a Login Notice feature in Group policy but it’s not as attractive as graphical wallpapers with message which grabs the att…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now