TechSpace Knowledgebase
Search:     Advanced search
Browse by category:
Contact Us

TCP/IP Command-line

Views: 568
Votes: 0
Posted: 27 Mar, 2016
by: Wonglangga S.
Updated: 29 Apr, 2016
by: Wonglangga S.

Command-line utilities

Viewing configuration by using ipconfig /all

When you troubleshoot a TCP/IP networking problem, begin by checking the TCP/IP configuration on the computer that is experiencing the problem. You can use the ipconfig command to get host computer configuration information, including the IP address, subnet mask, and default gateway.


  • For clients running Windows 95, Windows 98, and Windows Millennium Edition, use the winipcfg command instead of ipconfig.

When you use the ipconfig command with the /all option, a detailed configuration report is produced for all interfaces, including any configured serial ports. With ipconfig /all, you can redirect command output to a file and paste the output into other documents. You can also use this output to confirm the TCP/IP configuration of each computer on the network or to further investigate TCP/IP network problems.

For example, if a computer is configured with an IP address that is a duplicate of an existing IP address, the subnet mask appears as

The following example shows the output of the ipconfig /all command on a computer that running Windows XP Professional and is configured to use the DHCP server for automatic TCP/IP configuration, and WINS and DNS servers for name resolution.

 IP Configuration

        Node Type . . . . . . . . . : Hybrid
        IP Routing Enabled. . . . . : No
        WINS proxy Enabled. . . . . : No

Ethernet adapter Local Area Connection:

        Host Name . . . . . . . . . :
        DNS Servers . . . . . . . . :
        Description . . . . . . . . : 3Com 3C90x Ethernet Adapter
        Physical Address. . . . . . : 00-60-08-3E-46-07
        DHCP Enabled. . . . . . . . : Yes
        Autoconfiguration Enabled . : Yes
        IP Address. . . . . . . . . :
        Subnet Mask . . . . . . . . :
        Default Gateway . . . . . . :
        DHCP Server . . . . . . . . :
        Primary WINS Server . . . . :
        Secondary WINS Server . . . :
        Lease Obtained. . . . . . . : Wednesday, September 02, 1998 10:32:13 AM
        Lease Expires . . . . . . . : Friday, September 18, 1998 10:32:13 AM

If no problems appear in the TCP/IP configuration, the next step is testing the ability to connect to other host computers on the TCP/IP network.

Viewing configuration by using the Status feature

An alternate method of viewing configuration is available through the Status feature of a network connection. For more information, see View the status of a local area connection.

Refreshing configuration by using ipconfig /renew

When you troubleshoot a TCP/IP networking problem, begin by checking the TCP/IP configuration on the computer that is experiencing the problem. If the computer is DHCP-enabled and is using a DHCP server to obtain configuration, you can initiate a refresh of the lease by using the ipconfig /renew command.

When you use ipconfig /renew, all network adapters on the computer that uses DHCP (except those that are manually configured) try to contact a DHCP server and renew their existing configuration or obtain a new configuration.

You can also use the ipconfig command with the /release option to immediately release the current DHCP configuration for a host.


  • For Windows 95, Windows 98, and Windows Millennium Edition DHCP-enabled clients, use the release and renew options of the winipcfg command instead of ipconfig /release and ipconfig /renew to perform manual release or renewal of the IP configuration lease for a client.

Repair feature

As an alternative to ipconfig you can use Repair to renew LAN or high-speed Internet connection IP settings. Repair performs a series of commands that repair a connection. The commands that are invoked by Repairare listed below with their command-line equivalents:

Repair Command-line equivalent

Checks whether DHCP is enabled and, if enabled, issues a broadcast renew to refresh the IP address

No command line equivalent available

Flushes the ARP cache

arp -d *

Flush the NetBIOS cache

nbtstat -R

Flushes the DNS cache

ipconfig /flushdns

Re-registers with WINS

nbtstat -RR

Re-registers with DNS

ipconfig /registerdns


  • Repair uses a broadcast renew and will cause a computer to accept any lease from any DHCP server that is on the network. In contrast, a unicast renew (ipconfig /renew) will only renew the existing lease from the last DHCP server from which the client got a lease. 

For more information, see Repair a LAN or high-speed Internet connection.

Managing DNS and DHCP class IDs by using ipconfig

You can also use the ipconfig command to:

Testing connections by using ping

The ping command helps to verify IP-level connectivity. When troubleshooting, you can use ping to send an ICMP echo request to a target host name or IP address. Use ping whenever you need to verify that a host computer can connect to the TCP/IP network and network resources. You can also use ping to isolate network hardware problems and incompatible configurations.

It is usually best to verify that a route exists between the local computer and a network host by first using the ping command and the IP address of the network host to which you want to connect. Try pinging the IP address of the target host to see if it responds, as follows:

ping IP_address

You should perform the following steps when using ping:

  1. Ping the loopback address to verify that TCP/IP is configured correctly on the local computer. 

  2. Ping the IP address of the local computer to verify that it was added to the network correctly. 

  3. Ping the IP address of the default gateway to verify that the default gateway is functioning and that you can communicate with a local host on the local network. 

  4. Ping the IP address of a remote host to verify that you can communicate through a router. 


The ping command uses Windows Sockets-style name resolution to resolve a computer name to an IP address, so if pinging by address succeeds, but pinging by name fails, then the problem lies in address or name resolution, not network connectivity. For more information, see Troubleshooting hardware addresses by using arp.

If you cannot use ping successfully at any point, confirm that:

  • The computer was restarted after TCP/IP was configured.
  • The IP address of the local computer is valid and appears correctly on the General tab of the Internet protocol (TCP/IP) properties dialog box.
  • IP routing is enabled and the link between routers is operational.

You can use different options with the ping command to specify the size of packets to use, how many packets to send, whether to record the route used, what Time-to-Live (TTL) value to use, and whether to set the "don't fragment" flag. You can type ping -? to see these options.

The following example illustrates how to send two pings, each 1,450 bytes in size, to IP address

C:\>ping -n 2 -l 1450
Pinging with 1450 bytes of data:

Reply from bytes=1450 time<10ms TTL=32
Reply from bytes=1450 time<10ms TTL=32

Ping statistics for
    Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate roundtrip times in milliseconds:
    Minimum = 0ms, Maximum =  10ms, Average =  2ms

By default, ping waits 4,000 milliseconds (4 seconds) for each response to be returned before displaying the "Request Timed Out" message. If the remote system being pinged is across a high-delay link, such as a satellite link, responses may take longer to be returned. You can use the -w (wait) option to specify a longer time-out.

Troubleshooting hardware addresses by using arp

The Address Resolution protocol (ARP) allows a host to find the media access control address of a host on the same physical network, given the IP address of the host. To make ARP efficient, each computer caches IP-to-media access control address mappings to eliminate repetitive ARP broadcast requests.

You can use the arp command to view and modify the ARP table entries on the local computer. The arp command is useful for viewing the ARP cache and resolving address resolution problems.

For more information, see View the Address Resolution Protocol (ARP) cache and Add a static ARP cache entry.

Troubleshooting NetBIOS names by using nbtstat

NetBIOS over TCP/IP (NetBT) resolves NetBIOS names to IP addresses. TCP/IP provides many options for NetBIOS name resolution, including local cache lookup, WINS server query, broadcast, DNS server query, and Lmhosts and Hosts file lookup.

Nbtstat is a useful tool for troubleshooting NetBIOS name resolution problems. You can use the nbtstat command to remove or correct preloaded entries:

  • nbtstat -n displays the names that were registered locally on the system by programs such as the server and redirector.
  • nbtstat -c shows the NetBIOS name cache, which contains name-to-address mappings for other computers.
  • nbtstat -R purges the name cache and reloads it from the Lmhosts file.
  • nbtstat -RR releases NetBIOS names registered with a WINS server and then renews their registration.
  • nbtstat -a name performs a NetBIOS adapter status command against the computer specified by name. The adapter status command returns the local NetBIOS name table for that computer plus the media access control address of the adapter.
  • nbtstat -S lists the current NetBIOS sessions and their status, including statistics, as shown in the following example: 
    NetBIOS connection table
    Local name State     In/out Remote Host    Input   Output
    CORP1 <00> Connected Out    CORPSUP1<20>   6MB     5MB
    CORP1 <00> Connected Out    CORPPRINT<20>  108KB   116KB
    CORP1 <00> Connected Out    CORPSRC1<20>   299KB   19KB
    CORP1 <00> Connected Out    CORPEMAIL1<20> 324KB   19KB
    CORP1 <03> Listening

Displaying connection statistics by using netstat

You can use the netstat command to display protocol statistics and current TCP/IP connections. The netstat -a command displays all connections, and netstat -r displays the route table plus active connections. Thenetstat -o command displays process IDs so you can view the owner of the port for each connection. The netstat -e command displays Ethernet statistics, and netstat -s displays per-protocol statistics. If you usenetstat -n, addresses and port numbers are not converted to names. The following shows sample output for netstat:

C:\>netstat -e
Interface Statistics

                       Received      Sent
Bytes                  3995837940    47224622
Unicast packets        120099        131015
Non-unicast packets    7579544       3823
Discards               0             0
Errors                 0             0
Unknown protocols      363054211

C:\>netstat -n -o

Active Connections
  proto  Local Address          Foreign Address        State           PID
  TCP        CLOSE_WAIT      180
  TCP       ESTABLISHED     4
  TCP        CLOSE_WAIT      364
  TCP    ESTABLISHED     1128
  TCP    ESTABLISHED     1128
  TCP    ESTABLISHED     908
  TCP    ESTABLISHED     908
  TCP      TIME_WAIT       0
  TCP       TIME_WAIT       0
  TCP      TIME_WAIT       0
  TCP      TIME_WAIT       0
  TCP      TIME_WAIT       0
  TCP      TIME_WAIT       0
  TCP      TIME_WAIT       0
  TCP      TIME_WAIT       0
  TCP      TIME_WAIT       0
  TCP      TIME_WAIT       0

C:\>netstat -a

Active Connections

 proto Local Address      Foreign Address       State
 UDP  CORP1:1025       *:*
 UDP  CORP1:snmp       *:*
 UDP  CORP1:nbname     *:*
 UDP  CORP1:nbdatagram *:*
 UDP  CORP1:nbname     *:*
 UDP  CORP1:nbdatagram *:*

C:\>netstat -s
IP Statistics

 Packets Received             = 5378528
 Received Header Errors       = 738854
 Received Address Errors      = 23150
 Datagrams Forwarded          = 0
 Unknown protocols Received   = 0
 Received Packets Discarded   = 0
 Received Packets Delivered   = 4616524
 Output Requests              = 132702
 Routing Discards             = 157
 Discarded Output Packets     = 0
 Output Packet No Route       = 0
 Reassembly Required          = 0
 Reassembly Successful             = 0
 Reassembly Failures               = 0
 Datagrams Successfully Fragmented = 0
 Datagrams Failing Fragmentation   = 0
 Fragments Created                 = 0

ICMP Statistics
                          Received  Sent
 Messages                 693       4
 Errors                   0         0
 Destination Unreachable  685       0
 Time Exceeded            0         0
 Parameter problems       0         0
 Source Quenches          0         0
 Redirects                0         0
 Echoes                   4         0
 Echo Replies             0         4
 Timestamps               0         0
 Timestamp Replies        0         0
 Address Masks            0         0
 Address Mask Replies     0         0

TCP Statistics

 Active Opens                 = 597
 Passive Opens                = 135
 Failed Connection Attempts   = 107
 Reset Connections            = 91
 Current Connections          = 8
 Segments Received            = 106770
 Segments Sent                = 118431
 Segments Retransmitted       = 461
UDP Statistics

 Datagrams Received   = 4157136
 No Ports             = 351928
 Receive Errors       = 2
 Datagrams Sent       = 13809

Tracing network connections by using tracert

Tracert (Trace Route) is a route-tracing utility that is used to determine the path that an IP datagram takes to reach a destination. The tracert command uses the IP Time-to-Live (TTL) field and ICMP error messages to determine the route from one host to another through a network.

How tracert works

The Tracert diagnostic utility determines the route taken to a destination by sending Internet Control Message protocol (ICMP) echo packets with varying IP Time-to-Live (TTL) values to the destination. Each router along the path is required to decrement the TTL on a packet by at least 1 before forwarding it. When the TTL on a packet reaches 0, the router should send an "ICMP Time Exceeded" message back to the source computer.

Tracert determines the route by sending the first echo packet with a TTL of 1 and incrementing the TTL by 1 on each subsequent transmission until the target responds or the maximum TTL is reached. The route is determined by examining the "ICMP Time Exceeded" messages sent back by intermediate routers. Some routers silently drop packets with expired TTLs and are invisible to the Tracert utility.

The tracert command prints out an ordered list of the near-side interface of the routers in the path that returned the "ICMP Time Exceeded" message. If the -d option is used, the Tracert utility does not perform a DNS lookup on each IP address.

In the following example, the packet must travel through two routers ( and to get to host The default gateway of the host is and the IP address of the router on the network is

C:\>tracert -d
Tracing route to over a maximum of 30 hops
1     2 ms     3 ms     2 ms
2    75 ms    83 ms    88 ms
3    73 ms    79 ms    93 ms
Trace complete.

Troubleshooting with tracert

You can use the tracert command to determine where a packet stopped on the network. In the following example, the default gateway has determined that there is not a valid path for the host on There is probably a router configuration problem or the network does not exist (a bad IP address).

Tracing route to over a maximum of 30 hops
1  reports: Destination net unreachable.
Trace complete.

The Tracert utility is useful for troubleshooting large networks where several paths can be taken to arrive at the same point.

Tracert command-line options

The tracert command supports several options, as shown in the following table.

tracert [-d] [-h maximum_hops] [-j host-list] [-w timeouttarget_name

Option Description


Specifies that IP addresses are not resolved to host names.

-h maximum_hops

Specifies the number of hops to allow in tracing a route to the host named in target_name.

-j host-list

Specifies the list of router interfaces in the path taken by the Tracert utility packets.

-w timeout

Waits the number of milliseconds specified by timeout for each reply.


Name or IP address of the target host.

For more information, see Trace a path by using the tracert command.

Testing routers by using pathping

The pathping command is a route tracing tool that combines features of the ping and tracert commands with additional information that neither of those tools provides. The pathping command sends packets to each router on the way to a final destination over a period of time, and then computes results based on the packets returned from each hop. Since the command shows the degree of packet loss at any given router or link, it is easy to determine which routers or links might be causing network problems. A number of options are available, as shown in the following table.

Option Name Function



Does not resolve addresses to host names.


Maximum hops

Maximum number of hops to search for target.



Loose source route along host list.



Number of milliseconds to wait between pings.



Number of queries per hop.



Waits this many milliseconds for each reply.



Use the specified source address.



Force pathping to use IPv4.



Force pathping to use IPv6.

The default number of hops is 30, and the default wait time before a time-out is 3 seconds. The default period is 250 milliseconds, and the default number of queries to each router along the path is 100.

The following is a typical pathping report. The compiled statistics that follow the hop list indicate packet loss at each individual router.

D:\>pathping -n server1

Tracing route to server1 []
over a maximum of 30 hops:

Computing statistics for 125 seconds...
            Source to Here   This Node/Link
Hop  RTT    Lost/Sent = Pct  Lost/Sent = Pct  Address
                                0/ 100 =  0%   |
  1   41ms     0/ 100 =  0%     0/ 100 =  0%
                               13/ 100 = 13%   |
  2   22ms    16/ 100 = 16%     3/ 100 =  3%
                                0/ 100 =  0%   |
  3   24ms    13/ 100 = 13%     0/ 100 =  0%
                                0/ 100 =  0%   |
  4   21ms    14/ 100 = 14%     1/ 100 =  1%
                                0/ 100 =  0%   |
  5   24ms    13/ 100 = 13%     0/ 100 =  0%

Trace complete.

When pathping is run, you first see the results for the route as it is tested for problems. This is the same path that is shown by the tracert command. The pathping command then displays a busy message for the next 125 seconds (this time varies by the hop count). During this time, pathping gathers information from all the routers previously listed and from the links between them. At the end of this period, it displays the test results.

The two rightmost columns--This Node/Link Lost/Sent=Pct and Address--contain the most useful information. The link between (hop 1), and (hop 2) is dropping 13 percent of the packets. All other links are working normally. The routers at hops 2 and 4 also drop packets addressed to them (as shown in the This Node/Link column), but this loss does not affect their forwarding path.

The loss rates displayed for the links (marked as a | in the rightmost column) indicate losses of packets being forwarded along the path. This loss indicates link congestion. The loss rates displayed for routers (indicated by their IP addresses in the rightmost column) indicate that those routers' CPUs might be overloaded. These congested routers might also be a factor in end-to-end problems, especially if packets are forwarded by software routers.

Others in this Category
document How to Clear Your Computer’s CMOS to Reset BIOS Settings
document Install Hyper-V and create a virtual machine
document Configure DHCP Using Policy-based Assignment
document What Are Domains and Forests?
document Phoenix ISA/MCA/EISA BIOS Beep Codes
document How to make a self extracting archive that runs your setup.exe with 7zip -sfx switch
document Configuring a Syslog Agent in Windows Server 2012
document Configuring PHP Development Environment in Windows
document Installing and Configuring target iSCSI server on Windows Server 2012
document How To Make UEFI Bootable USB Flash Drive to Install Windows 8
document How to set up an Internet email account in Outlook 2013 or 2016
document Enable Hyper-V on Windows 8.1
document Quickly Turn ON/OFF Windows Firewall Using Command Line
document How to List All of the Windows and Software Updates Applied to a Computer
document How to Repair a Windows 7 System with an Installation Disc
document How to Create Bootable USB from a Windows ISO
document How to Create Bootable USB from an IMG File
document 20 Terminal shortcuts developers need to know
document How to Update Your BIOS
document Getting Started With Lync Mobile 2010 For Android Devices
document "Attachment size exceeds the allowable limit" error when you add a large attachment to an email message in Outlook
document How do I renew the IP address for my computer ?
document Is your Windows 10 PC slowing you down, and the SFC utility is unable to fix the problem? Then use DISM to repair the Windows image to enable SFC to do its job.
document How to make a full backup of a Windows 10 or Windows 8.1 PC
document How to create a System Restore Point in Windows 10 with a simple double-click
document How to properly remove the Windows.old folder on Windows 10
document How control your Windows 10 PC or phone with another computer with the Connect app
document How to use Bing images within Office and Edge on Windows 10 PC.
document How to fix taskbar search not working in Windows 10
document How to disable or uninstall OneDrive on Windows 10 PC
document How to re-activate Windows 10 after a hardware change
document How to change the system language across your whole Windows 10 PC
document Use Windows Defender Offline to remove tough viruses from your Windows 10 PC
document 16 Essential keyboard shortcuts everyone should know using Continuum for phones
document How to disable Action Center in Windows 10
document How to use Storage Spaces in Windows 10
document How to generate a Battery Report in Windows 10.
document Create Fake File in Window PC in Any Size and Any Format
document How to perform an image backup in Windows 8.1 or 10
document Block Windows 10 Upgrade
document Chrome reset for adware issues
document Revert from Windows 10 back to previous operating system
document Windows 7 Guide to using Microsoft Security Essentials
document Force Dragon Naturally Speaking to load a particular user profile
document Texthelp Read and Write Gold Prediction returns strange results or receives double letters
document Connect Powershell to your Windows Azure subscription
document How to set up desktop background image rotation in Windows 8
document How to adjust your Laptops screen brightness in Windows 8/8.1
document Microsoft Security Essential Install, Windows 7
document Set the default Microsoft Word template back to a blank document
document Schedule Windows to shutdown or restart after a time limit
document 20 Windows 8 and 8.1 shortcuts
document Bypass Windows 8 and 8.1 login screen
document All the Ways You Can Still Get Windows 10 for Free
document The Complete Guide to Giving Better Family Tech Support
document How to Stop Skype from Running in the Background on Windows 10
document How to Upgrade to a Larger Hard Drive Without Reinstalling Windows
document How to Find and Remove Duplicate Files on Windows
document Scammers Are Using a Fake Version of AdwCleaner to Trick People
document How to Use OneDrive as Your Default Save Location on Windows 8.1
document How To Fix a Blue Screen of Death
document How To Fix Comdlg32.dll Not Found or Missing Errors
document How to Fix Fm20.dll Not Found or Missing Errors
document How to Fix Gdi32.dll Not Found or Missing Errors
document How To Fix Libxml2.dll Not Found or Missing Errors
document How to Fix Mfc42.dll Not Found or Missing Errors
document How to Fix Mfc90.dll Not Found or Missing Errors
document How To Fix Msvcp71.dll Not Found or Missing Errors
document How To Fix Msvcp80.dll Not Found or Missing Errors
document How To Fix Msvcr70.dll Not Found or Missing Errors
document How To Fix Msxml6.dll Errors
document How to Fix Ole32.dll Not Found or Missing Errors
document How To Fix Oleaut32.dll Not Found or Missing Errors
document How To Fix Shell32.dll Not Found or Missing Errors
document How To Fix Sqlite3.dll Not Found or Missing Errors
document How To Fix Ssleay32.dll Not Found or Missing Errors
document How To Fix STOP 0x00000005 Errors
document How To Fix STOP 0x0000007B Errors
document Keep the Windows 10 Taskbar Visible While Using the On-Screen Keyboard
document EdgeDeflector Forces Cortana to Use Your Default Web Browser
document How to Move the Clock to Right-Most Corner on the Taskbar in Windows 10
document Add Control Panel (Or Any Program) To Your Right-Click Menu With a Registry Tweak
document Six Keyboard Shortcuts Every Computer User Should Know
document How to Upgrade Your Computer's Login Screen
document How to Use Windows 8's New File History Backup (aka Time Machine for Windows)
document What Kind of Maintenance Do I Need to Do on My Windows PC?
document How to Do a Clean Install of Windows Without Losing Your Files, Settings, and Tweaks
document How to disable Microsoft Windows 10 keylogger (enabled by default)
document How to Use the Cortana Voice Assistant in Windows 10
document How to Map a Network Drive in Windows 10
document How to Sync Your iPhone with Windows 10
document How to turn Off Windows Update in Windows 10
document How to Change a NetBIOS Name
document How to turn off Windows Automatic Updates in Windows 8/8.1
document How To Disable Updates in Windows 7
document How to Run Disk Cleanup on a Windows 7 Computer
document How to Check If Windows 10 Is Activated or Not
document How to Check CPU Speed
document How to Create a Shortcut to Windows Update in Windows 10
document How to Enter the BIOS Setup Utility or Boot Menu with windows
document How to Install Drivers
document How to Check the Application Event Log for Errors
document How to Optimize Windows 10 Performance by tweaking Visual Effects
document How to Setting Password Protected Print Jobs
document How to Change User Account Name in Windows 10
document How to Set Up and Use Remote Desktop for Windows 10
document How to Find Drivers for Devices Using a Hardware ID
document How to Changing BIOS mode from UEFI to Legacy
document How to Speed Up Windows 10
document How to Outlook 2010 - Rebuild the index file
document How To Fix Outlook 2016 Search Problems
document How to Release and renew IP address
document How to HP Printers - USB Printer Setup (Windows)
document How to disable Windows Defender in Windows 7
document How to Turn On or Off Windows Defender in Windows 8 and 8.1
document How to Use Simple IF Statements in Excel
document Why Does 64-Bit Windows Need Two Program Files Folders?
document How to Assign a Static IP Address in Windows 7, 8, 10, XP, or Vista
document How to manually add a print server port?
document How to Join Your Computer to a Domain
document How to Force a Blue Screen in Windows
document How to Use All of Windows 10 Backup and Recovery Tools
document How To Repair HDD with DLC 2015
document How to change XAMPP apache server port?
document How to find computer serial number
document How to use Rufus to create a bootable USB drive to install (almost) any OS
document How do I format a USB Flash Drive to NTFS file system?
document Change RAID Type of a Volume or Disk Group
document Create an Admin User Account Using CMD Prompt (Windows)
document How to Find Your MAC Address in Windows 10
document How To Repair Windows 10
document Repair an Office application
document Add an email account to Outlook for PC
document How to install Office 365 on Windows PC
document How to test your home internet connection speed