Development

How to reset the TCP-IP Stack in Windows

Captain Salem 3 min read

How to reset the TCP/IP Stack on Windows

Transmission Control Protocol/Internet Protocol or TCP/IP is one of the most useful and fundamentals protocols that powers the internet and device communication. TCP/IP provides the rules and features used by device communication using packets, network addresses, routing, and more.

TCP/IP is built into most devices to faciliate device communication, either internally or via the internet. However, it can be difficult to troubleshoot is something is not working correctly This is becuase TCP/IP is composed of a lot of moving parts from the cables to the sofware in your router.

Luckily, unless its a hardware problem, you can restore your connectivity on your device by simply performing a reset on the TCP/IP Stack.

How to Reset the TCP/IP Stack on Windows

In Windows, we can reset the TCP/IP stack simply by running a few set of commands. Keep in mind you will require administrative permissions to run the commands successfully.

Start by opening the Command prompt, Windows Terminal, or PowerShell with administrative permissions.

image-20220929102012205

Once in the command prompt, run the command below to reset the TCP/IP Stack:

netsh int ip reset

You should see and output as shown:

PS C:\Users\geekbits> netsh int ip reset
Resetting Compartment Forwarding, OK!
Resetting Compartment, OK!
Resetting Control Protocol, OK!
Resetting Echo Sequence Request, OK!
Resetting Global, OK!
Resetting Interface, OK!
Resetting Anycast Address, OK!
Resetting Multicast Address, OK!
Resetting Unicast Address, OK!
Resetting Neighbor, OK!
Resetting Path, OK!
Resetting Potential, OK!
Resetting Prefix Policy, OK!
Resetting Proxy Neighbor, OK!
Resetting Route, OK!
Resetting Site Prefix, OK!
Resetting Subinterface, OK!
Resetting Wakeup Pattern, OK!
Resetting Resolve Neighbor, OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , failed.
Access is denied.

Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Restart the computer to complete this action.

The command will locate and reset all the TCP/IP settings on your machine to the default. This process requires you to restart your machine to apply the changes.

How Does Resetting the TCP/IP Stack Work?

You may be wondering, what happens when I run the command above?

The TCP/IP settings that are used by your device to connect and communicate with other devices are stored locally. Specifically, Windows stores those settings in the registry.

To view the current TCP/IP settings, run the command:

$ Reg Query "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"

The command above returns the values of the registry key HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

As the name suggest, this key holds parameters for the TCP/IP settings on your local machine. These include: Hostname, DHCPServer, Domain, PortTracker status, etc.

An example output is as shown:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
    DataBasePath    REG_EXPAND_SZ    %SystemRoot%\System32\drivers\etc
    Domain    REG_SZ
    ForwardBroadcasts    REG_DWORD    0x0
    ICSDomain    REG_SZ    mshome.net
    IPEnableRouter    REG_DWORD    0x0
    NameServer    REG_SZ
    SyncDomainWithMembership    REG_DWORD    0x1
    NV Hostname    REG_SZ    local
    Hostname    REG_SZ    local
    DhcpNameServer    REG_SZ    192.168.1.1
    PortTrackerEnabledMode    REG_DWORD    0x2

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Adapters
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DNSRegisteredAdapters
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NsiObjectSecurity
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Winsock

For graphical users, you can find values in the Registry Editor as:

image-20220929103457722

The reset command also removes the DHCP parameters which holds values as shown:

Reg Query "HKLM\SYSTEM\CurrentControlSet\Services\Dhcp\Parameters"

Output:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dhcp\Parameters
    ServiceDll    REG_EXPAND_SZ    %SystemRoot%\system32\dhcpcore.dll
    ServiceDllUnloadOnStop    REG_DWORD    0x1

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dhcp\Parameters\Options
image-20220929103809005

Therefore, when you run the netsh int ip reset command, Windows replaces the registry keys shown above with the default values. This ensures that the stack is set to defualt and overwrites any incorrect settings.

COnclusion

In this guide, you discovered a simple command that allows you to reset your TCP/IP Stack on your Windows machine. You also learned what the command does and how to fetch the values of the target Registry keys.

Resetting your Stack is one of the troubleshooting techniques you should attempt when having connection problems.

We hope you enjoyed this tutorial. If you did, leave a comment down below and share with your friends.

Thanks for reading, catch you in the next one!!

Share
Comments
More from Cloudenv

Cloudenv

Developer Tips, Tricks and Tutorials.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Cloudenv.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.