Thursday 22 March 2012

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:

C:\Windows\system32> netsh int ip reset C:\netsh.log.txt
C:\Windows\system32> 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:
C:\Windows\system32> 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:
C:\Windows\system32>netsh interface ip set address name="Local Area Connection" dhcp

Configure the LAN adapter’s secondary DNS:
C:\Windows\system32> netsh interface ip add dns name="Local Area Connection" 8.8.8.8 index=2