Alexander's Blog

Sharing knowledge with the global IT community since November 1, 2004

How to Reset TCP/IP on Windows Computers

/
/
Alexander's Blog

The Transmission Control Protocol/Internet Protocol (TCP/IP) is the communication protocol used on the Internet. It’s also used on the private networks. In earlier versions of Windows, TCP/IP was a separate optional component that could be removed or added like any other protocol. As far as I recall, starting with Windows XP/Server 2003 TCP/IP became a core component of the operating system and couldn’t be removed. It makes sense to make TCP/IP a core component of Windows because its functionally is especially critical on Microsoft Windows Servers for network operations and Active Directory domain environment. The entire Active Directory architecture is based on DNS hierarchy, which relies on TCP/IP.

There are situations where you may experience a corrupt TCP/IP stack on your Windows Servers or client workstations. This could be due to a malware infection, or it may be caused by the applications running on your computer. Although TCP/IP stack corruption is rare, it causes a major problem because you can’t remove and reinstall TCP/IP anymore. So what’s the solution? Reinstalling the operating system? Well, that’s one option. However, a better option is to simply reset TCP/IP to the default state when the operating system was installed. When you reset TCP/IP, you overwrite the following Windows registry keys.

  • SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
  • SYSTEM\CurrentControlSet\Services\DHCP\Parameters

NOTE: Resetting TCP/IP can not only solve some of the Internet connectivity issues, it can also help solve connectivity issues on your local network. In addition, it can also be useful in solving problems that can be caused by a corrupt TCP/IP stack, such as slow network access.

The NetShell Utility

You can use the NetShell (netsh.exe) utility to reset TCP/IP on any Windows computer, server or client. When you reset TCP/IP, it will rewrite all the important keys in the registry which has the effect of removing and reinstalling the entire TCP/IP stack. The netsh.exe is a command line tool which allows you to monitor and configure networking components in Windows. To run this tool, start the command prompt with administrative credentials and type netsh. Type help, or a question mark “?” without the quote to see the list of commands that are available in NetShell.

Resetting TCP/IP

TCP/IP is not just a single protocol, it’s a suite of protocols. Netsh offers the options to manage the interface in context of IPv4, IPv6, and TCP. In Windows XP, the options were available for IP and IPV6, where IP was assumed to be IPV4. There was no option for TCP. Starting with Windows 7, the NetShell utility in all versions of Windows client operating systems has the ability to set the interface context to IPv4, IPv6, and TCP. The same is true for the newer versions of Windows Servers starting Windows Server 2003.

NOTE: By default, Windows computers run both the TCP/IP version 4 and TCP/IP version 6 protocols side by side. There is no harm in running both the protocols. If you were to disable TCP/IP v4, you may not be able to connect to the Internet because not all routers in the world support TCP/IP v6 at this time. If you disable TCP/IP v6  you can run into some serious problems on your Windows network. According to Microsoft, disabling TCP/IP v6 is a very bad idea because it can break certain features and services in Windows.

Setting the context means you can take action on the individual components and configure or manage various options on your network. To reset TCP/IP, you don’t need to reset IPv4, IPv6 and TCP individually. According to Microsoft’s article 299357, to reset the entire TCP/IP stack you only need to specify IP as the interface. I know, unlike Windows XP, the IP option is not listed under the available options in the above screenshot, but you can use the following command to reset TCP/IP.

netsh interface ip reset

NOTE: You can either type the word interface, or use the abbreviation int, when working with the NetShell utility.

NOTE: The Microsoft article I mentioned above incorrectly states that “To run the manual command successfully, you must specify a name for the log file in which the netsh actions will be recorded.” Specifying a name for the log file is optional and has no affect on the command used to reset TCP/IP. Here’s what a sample log file looks like.

Restart the computer after resetting TCP/IP.

Consequences of Resetting TCP/IP

When you have a problem with the TCP/IP stack, resetting is way easier then reinstalling the operating system because there is no easy way to fix a corrupt TCP/IP stack. Although, I have never experienced any drawback by resetting TCP/IP, I won’t recommend it doing it as a hobby. It’s better to do it as a last resort, rather than trying it as your first option. If you have configured a static IP address, which is the case with Windows Servers, you may have to reconfigure your IP address after resetting it. Therefore, it is best to document your TCP/IP configuration before you reset it. If you are using DHCP to automatically configure the TCP/IP settings, which is usually the case with Windows clients in corporate environment and most home computers, then you won’t have to worry about configuring anything. You simply restart the computer after resetting TCP/IP and that’s it.

Resetting Winsock

If for some reason resetting TCP/IP didn’t solve the problem with your Internet or local network connectivity, you may also consider resetting Winsock, which is a programming interface that handles communications between Internet applications and the Windows operating system. Wikipedia defines it as follows:

“In computing, the Windows Sockets API (WSA), later shortened to Winsock, is a technical specification that defines how Windows network software should access network services, especially TCP/IP. It defines a standard interface between a Windows TCP/IP client application (such as an FTP client or a web browser) and the underlying TCP/IP protocol stack.”

Winsock is not part of the TCP/IP stack. However, because Winsock defines the interface between the TCP/IP client application and the TCP/IP stack, resetting Winsock can be helpful in many situations. To reset Winsock use the following command. Make sure you are logged in as an Administrator.

netsh winsock reset

Restart the computer after resetting Winsock.

Resetting Winsock will reset the Winsock Catalog, but won’t affect the Winsock Name Space Provider entries. However, if you have any Winsock Layered Service Providers installed, you must reinstall them. An example of Winsock Layered Service Provider is the Microsoft Firewall Client Service Provider installed as part of Internet Security and Acceleration (ISA) Server on clients, or the Microsoft Forefront Firewall Service and the Threat Management Gateway (TMG) Client on clients. However, Layered Service Providers have been deprecated. Starting with Windows 8 and Windows Server 2012, it has been replaced with Windows Filtering Platform. For more information, check out Microsoft’s article Categorizing Layered Service Providers and Applications.

Thanks for reading my article. If you are interested in IT training & consulting services, please reach out to me. Visit ZubairAlexander.com for information on my professional background.

Copyright © 2017 SeattlePro Enterprises, LLC. All rights reserved.

  • Facebook
  • Twitter
  • Linkedin

Leave a Comment

Your email address will not be published. Required fields are marked *

This div height required for enabling the sticky sidebar