Command Line Utilities - DNS, DHCP, TCP/IP
Command Line Utilities - DNS, DHCP, TCP/IP
Note
• For clients running Windows 95, Windows 98, and Windows Millennium Edition, use the winipcfg
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 0.0.0.0.
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.
Copy Code
IP Configuration
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.
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.
Note
• 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 Repair are
listed below with their command-line equivalents:
Checks whether DHCP is enabled and, if enabled, issues a broadcast renew No command line equivalent
to refresh the IP address available
Important
• 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 Flush and reset a client resolver cache using the ipconfig command.
For more information, see Renew DNS client registration using the ipconfig command.
For more information, see Show DHCP class ID information at a client computer.
For more information, see Set DHCP class ID information at a client computer.
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
1. Ping the loopback address to verify that TCP/IP is configured correctly on the local computer.
ping 127.0.0.1
2. Ping the IP address of the local computer to verify that it was added to the network correctly.
pingIP_address_of_local_host
3. Ping the IP address of the default gateway to verify that the default gateway is functioning and that you
pingIP_address_of_default_gateway
4. Ping the IP address of a remote host to verify that you can communicate through a router.
pingIP_address_of_remote_host
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.
• The IP address of the local computer is valid and appears correctly on the General tab of the Internet
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 131.107.8.1:
Copy Code
C:\>ping -n 2 -l 1450 131.107.8.1
Pinging 131.107.8.1 with 1450 bytes of data:
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:
Copy Code
Copy Code
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
C:\>netstat -a
Active Connections
C:\>netstat -s
IP Statistics
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
UDP Statistics
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 (10.0.0.1 and 192.168.0.1) to get to host
172.16.0.99. The default gateway of the host is 10.0.0.1 and the IP address of the router on the 192.168.0.0
network is 192.168.0.1.
Copy Code
C:\>tracert 172.16.0.99 -d
Tracing route to 172.16.0.99 over a maximum of 30 hops
1 2 ms 3 ms 2 ms 10.0.0.1
2 75 ms 83 ms 88 ms 192.168.0.1
3 73 ms 79 ms 93 ms 172.16.0.99
Trace complete.
Copy Code
C:\>tracert 192.168.10.99
Tracing route to 192.168.10.99 over a maximum of 30 hops
1 10.0.0.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.
Option Description
-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.
The following is a typical pathping report. The compiled statistics that follow the hop list indicate packet loss at
each individual router.
Copy Code
D:\>pathping -n server1
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 172.16.87.218 (hop 1), and 192.168.52.1 (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.