Collection of common network commands for Network Management

Source: Internet
Author: User

If you have played a vro, you will know the abbreviations of the interesting commands in the vro.
For example, "Sh int" means "show interface ".
Now Windows 2000 has a tool similar to the interface called netsh.

In the CMD shell of Windows 2000, enter netsh
Come out: netsh> prompt,
Enter an int IP address:
Interface ip>
Enter dump to view the network configuration of the current system:

# Interface IP configuration
Pushd interface IP

# Interface IP configuration for "Local Area Connection"

Set address name = "Local Area Connection" Source = static ADDR =
Mask =
Add address name = "Local Area Connection" ADDR = mask =
Set address name = "Local Area Connection" Gateway = gwmetric = 1
Set DNS name = "Local Area Connection" Source = static ADDR =
Set wins name = "Local Area Connection" Source = static ADDR = none

# End of interface IP configuration

The above describes a method of interactive operations.
Run the following command:
"Netsh interface IP add address" Local Area Connection ""
To add IP addresses.

It doesn't matter if you don't know the syntax!
At the prompt, enter? You can find the answer. Convenience and inconvenience?
In the past, Microsoft also had some things that people liked. Unfortunately, there are very few!

Windows Network command lineProgram
This part includes:

Use ipconfig/all to view configurations
Use ipconfig/renew to refresh the configuration
Use ipconfig to manage DNS and DHCP category IDS
Use ping to test the connection
Use ARP to solve hardware address problems
Use NBTSTAT to solve NetBIOS name problems
Use netstat to display connection statistics
Use tracert to track Network Connections
Use pathping to test the vro
Use ipconfig/all to view configurations
When detecting and solving TCP/IP network problems, first check the TCP/IP configuration on the computer where the problem occurs. Yes
Use the ipconfig command to obtain the host configuration information, including the IP address, subnet mask, and default gateway.


For Windows 95 and Windows 98 clients, use the winipcfg command instead of ipconfi.
G command.
When you use the ipconfig command with the/all option, detailed configuration reports for all interfaces are provided, including any
The configured serial port. You can use ipconfig/all to redirect command output to a file and
Paste the output to 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 the IP address configured by the computer is the same as the existing IP address, the subnet mask is displayed as 0.0.0
. 0.

The following example shows the ipconfig/all command output. The computer is configured to use the DHCP server for dynamic configuration.
TCP/IP, and use wins and DNS server to resolve the name.

Windows 2000 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,199 8 10:32:13 AM
Lease expires ......: Friday, September 18,199 8 10:32:13 AM

If the TCP/IP configuration is correct, perform the next step to connect to other hosts on the TCP/IP network.

Use ipconfig/renew to refresh the configuration
To solve a TCP/IP network problem, first check the TCP/IP configuration on the computer where the problem occurs. If the computer
Enable DHCP and use the DHCP server for configuration. Use the ipconfig/Renew command to refresh the rent.

When ipconfig/Renew is used, all NICs on the computer that uses DHCP (except those manually configured
Connect to the DHCP server whenever possible, update existing configurations or obtain new configurations.

You can also use the ipconfig command with the/release option to immediately release the current DHCP configuration of the host. Yes
For more information about DHCP and lease, see how clients obtain configurations.


For Windows 95 and Windows 98 that enable DHCP, use the rel command of winipcfg
Configure and renew options, instead of the ipconfig/release and ipconfig/Renew commands, manually
Release or update the customer's IP Address Configuration lease.
Use ipconfig to manage DNS and DHCP category IDS
You can also use the ipconfig command:

Displays or resets the DNS cache.
For more information, see use ipconfig to view or reset the client resolution program cache.

Refresh the registered DNS name.
For more information, see use ipconfig to update DNS customer registration.

Displays the DHCP category ID of the adapter.
For more information, see show DHCP category ID information on the client.

Set the DHCP category ID of the adapter.
For more information, see set DHCP category ID on the client.

Use ping to test the connection
The Ping Command helps verify IP connectivity. When detecting and solving the problem, you can ping the Target Master
The machine name or IP address sends an ICMP Response Request. You need to verify whether the host can connect to the TCP/IP network and network.
Use ping for resources. You can also use ping to isolate network hardware problems and incompatible configurations.

It is usually better to use the ping command to verify whether the route between the local computer and the network host exists and to connect
The IP address of the connected network host. Ping the IP address of the target host to check whether the host responds as follows:

Ping ip_address

Perform the following steps when using Ping:

Ping the loopback address to verify whether TCP/IP is installed on the Local Computer and whether the configuration is correct.

Ping the IP address of the Local Computer to verify that the IP address is correctly added to the network.
Ping ip_address_of_local_host

Ping the IP address of the default gateway to verify whether the gateway is running and whether it can communicate with the local host on the local network.
Ping ip_address_of_default_gateway

Ping the IP address of the remote host to verify whether the router can communicate.
Ping ip_address_of_remote_host

The ping command uses a Windows Socket style name to resolve the computer name to an IP address.
The IP address is successfully used, but the ping by name fails. The problem lies in the address or name resolution, rather than network connection.
Connectivity issues. For more information, see use ARP to solve hardware address problems.

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

After installing and configuring TCP/IP, restart the computer.
IP address of the local computer on the "General" tab of the "Internet Protocol (TCP/IP) properties" dialog box
Valid and correct.
Enable IP routing and the links between routers are available.
You can use different options of the ping command to specify the size of the data packet to be used, the number of data packets to be sent,
Indicates whether to record used routes, TTL values, and whether to set the "Do Not segment" flag. Yes
Enter Ping -? View these options.

The following example shows how to send two ping requests to IP address, each of which is 1,450 Bytes:

C:> Ping-N 2-l 1450
Pinging with 1450 bytes of data:

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

Ping statistics for
Packets: Sent = 2, stored ED = 2, lost = 0 (0% loss ),
Approximate roundtrip times in Milli-seconds:
Minimum = 0 ms, maximum = 10 ms, average = 2 ms
By default, before "request time-out" is displayed, Ping waits for 1,000 milliseconds (1 second) for each response to return. If the remote system tested by Ping goes through a long-delayed link, such as a satellite link, the response may take a longer time to return. You can use the-W (wait) option to specify a longer timeout period.

Use ARP to solve hardware address problems
The Address Resolution Protocol (ARP) allows the host to find the Media Access Control Address of the host on the same physical network, if the latter IP address is given. To make ARP more effective, each computer caches IP addresses to the Media Access Control Address ing to eliminate repeated ARP broadcast requests.

You can use ARP commands to view and modify ARP table items on the local computer. ARP commands are useful for viewing ARP caches and solving address resolution problems.

For more information, see view the Address Resolution Protocol (ARP) cache and add static ARP cache items.

Use NBTSTAT to solve NetBIOS name problems
The NetBIOS (netbt) on TCP/IP resolves the NetBIOS name into an IP address. TCP/IP provides many options for NetBIOS name resolution, including local cache search, WINS Server query, broadcast, DNS Server query, and LmHosts and host file search.

NBTSTAT is a useful tool for resolving NetBIOS name resolution issues. You can use the nbtstat command to delete or correct a pre-loaded project:

NBTSTAT-N displays the names registered locally on the system by programs such as the server or redirection.
NBTSTAT-C displays the NetBIOS name cache, including the name-to-address ing of other computers.
NBTSTAT-r clears the name cache and then reloads it from The LmHosts file.
NBTSTAT-rr releases the NetBIOS names registered on the WINS server, and refresh their registration.
NBTSTAT-a name executes the NetBIOS adapter STATUS Command on the computer specified by name. The adapter status command returns the local NetBIOS name table of the computer and the Media Access Control Address of the adapter.
NBTSTAT-s lists the current NetBIOS session and its 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> 6 MB 5 MB
Corp1 <00> connected out corpprint <20> kilobytes KB
Corp1 <00> connected out corpsrc1 <20> 299kb 19kb
Corp1 <00> connected out corpemail1 <20> 324kb 19kb
Corp1 <03> listening
Use netstat to display connection statistics
You can use the netstat command to display the Protocol statistics and the current TCP/IP connection. The netstat-a command displays all connections, while the netstat-R command displays the route table and active connections. The netstat-e command displays Ethernet statistics, while netstat-s displays statistics for each protocol. If netstat-N is used, the address and port number cannot be converted to the name. The following is an output example of 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-

Active connections

PROTO local address foreign address State
TCP corp1: 1572 nbsession established
TCP corp1: 1589 nbsession established
TCP corp1: 1606 nbsession established
TCP corp1: 1632 nbsession established
TCP corp1: 1659 nbsession established
TCP corp1: 1714 nbsession established
TCP corp1: 1719 nbsession established
TCP corp1: 1241 nbsession established
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
Inclued header errors = 738854
Received address errors = 23150
Required rams forwarded = 0
Unknown protocols committed ED = 0
Inclued 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 =
Required rams successfully fragmented = 0
Required rams 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

Required rams received = 4157136
No ports = 351928
Receive errors = 2
Required rams sent = 13809

Use tracert to track Network Connections
Tracert is a routing tracking utility used to determine the path adopted by the IP datagram access target. The tracert command uses the ip ttl field and the ICMP error message to determine the route from one host to other hosts on the network.

How tracert works
By sending "Internet Control Message Protocol (ICMP)" response packets with different TTL values to the target, the tracert diagnostic program determines the route adopted by the target. Each vro on the path must at least decrease the TTL of the data packet by 1 before forwarding the data packet. When the TTL value on the data packet is reduced to 0, the router should send the "ICMP timeout" message back to the source system.

Tracert sends a response packet whose TTL is 1, and increases TTL by 1 in each subsequent sending process until the target response or TTL reaches the maximum value to determine the route. Check the ICMP timeout message sent back by the Intermediate router to determine the route. Some routers directly discard TTL expired data packets without asking, which is not seen in the tracert utility.

The tracert command prints out the list of nearby router interfaces in the path that returns the "ICMP timeout" message in sequence. If the-D option is used, the tracert utility does not query DNS on each IP address.

In the following example, data packets must pass through two routers ( and to reach the host. The default gateway of the host is, And the IP address of the router on the Network
The address is

C: \> tracert
Tracing Route to over a maximum of 30 hops
1 2 S 3 S 2 S 10, 0.0, 1
2 75 MS 83 MS 88 MS
3 73 MS 79 MS 93 MS
Trace complete.
Use tracert to solve the problem
You can use the tracert command to determine the stop position of a data packet on the network. In the following example, the default gateway is 19
Route 10.99 host does not have a valid path. This may be caused by vro configuration or 192.168.10.
0 network does not exist (incorrect IP address ).

C: \> tracert

Tracing Route to over a maximum of 30 hops

1 reportsestination net unreachable.

Trace complete.

The tracert utility is very useful for solving large network problems. In this case, several paths can be taken to reach the same

Tracert command line options
The tracert command supports multiple options, as shown in the following table.

Tracert [-D] [-H maximum_hops] [-J host-list] [-W timeout] target_name

Option description
-D: do not resolve the IP address to the host name.
-H maximum_hops specifies the number of hops to track the route of the host called target_name.
-J host-List specifies the list of router interfaces in the path used by the tracert utility package.
-W Timeout: the number of milliseconds specified for each reply.
The target host name or IP address of target_name.

For more information, see trace paths using the tracert command.

Use pathping to test the vro
The pathping command is a routing tracking tool that combines the Ping and tracert commands with other information not provided by the two tools. The pathping Command sends data packets to each vro in the path to the destination within a period of time, and then returns the data packet-based computer results from each hop. Because the command shows how much data packets are lost on any given vro or link, it is easy to determine the vro or link that may cause network problems. Some options are available, as shown in the following table.

Option name Function
-N hostnames does not resolve the address to the host name.
-H maximum hops: the maximum number of hops for a search target.
-G host-list: Release the source route along the route list.
-P period: the number of milliseconds that a Ping can wait.
-Q num_queries: the number of queries per hop.
-W time-out indicates the number of milliseconds each reply takes.
-T Layer 2 tag connects the layer 2nd priority mark (for example, for IEEE 802.1 p) to the data packet and sends it to each network device in the path. This helps identify network devices that are not correctly configured with Layer 2 priority. The-T switch is used to test QoS connectivity.
-R rsvp isbase che check to determine whether each vro in the path supports the resource retention Protocol (RSVP), which allows the host to retain a certain amount of bandwidth for the data stream. The-r switch is used to test QoS connectivity.

The default number of hops is 30, and the default waiting time before timeout is 3 seconds. The default time is 250 milliseconds, and the number of queries per vro along the path is 100.

The following is a typical pathping report. The statistical information edited after the hop list indicates the packet loss on each independent router.

D: \> pathping-N MSW

Tracing Route to MSW []
Over a maximum of 30 hops:

Computing statistics for 125 seconds...
Source to here this node/Link
Hop RTT lost/sent = pct address
0/100 = 0% |
1 41 MS 0/100 = 0% 0/100 = 0%
13/100 = 13% |
2 22 Ms 16/100 = 16% 3/100 = 3%
0/100 = 0% |
3 24 Ms 13/100 = 13% 0/100 = 0%
0/100 = 0% |
4 21 Ms 14/100 = 14% 1/100 = 1%
0/100 = 0% |
5 24 Ms 13/100 = 13% 0/100 = 0%

Trace complete.

When you run pathping, first view the routing results when testing the problem. This path is the same as the path displayed by the tracert command. Then the pathping command displays a busy message for the next 125 milliseconds (this time varies according to the hop count ). During this period, pathping collects information between all the routers listed earlier and the links between them. At the end of this period, it displays the test results.

The rightmost two columns of this node/link lost/sent = pct and address are the most useful. (hops 1) and (hops 2) lose 13% of data packets. All other links are working properly. Routers in hops 2 and 4 also lose packets destined for them (as shown in this node/link column), but this loss does not affect the forwarding path.

the loss rate displayed on the Link (marked as | in the rightmost column) indicates that the lost data packets are forwarded along the path. This loss indicates that the link is blocked. The loss rate displayed on the router (displayed by the IP address in the rightmost sidebar) indicates that the CPU of these routers may be overloaded. These congested routers may also cause peer-to-peer problems, especially when the software router forwards packets.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.