Reset TCP/IP networking stack in Windows 7 and Vista

 

Sometimes your DHCP service is not able to pull an IP address, the reason could be that the network stack on Windows goes banana. To fix the problem, open command prompt with administrator privilege (click on Start → type in “cmd” → right click on the command prompt and choose “Run as Administrator”) and type these command:

netsh int ip reset C:\netsh.log.txt
netsh winsock reset

… then all your network configuration will be reset.

Update: The command netsh is very powerful, you can control a lot of things in Windows with it, like network interfaces, route table …

Some examples:

  • Set the LAN adapter to static IP address:

    netsh interface ip set address name="Local Area Connection" static 192.168.10.15 255.255.255.0 192.168.10.1 1

  • Set the LAN adapter to DHCP:

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

  • Configure the LAN adapter’s secondary DNS:

    netsh interface ip add dns name="Local Area Connection" 8.8.8.8 index=2

Related posts:

  • Jason

    With the end of life announcement of XP SP2, and the recent MS10-046 bug, do you think now is a good time to upgrade to Win 7?

    Here's a quick fix for the MS10-046 issue: http://links.maas360.com/MS10046