假如你玩過路由器的話,就知道路由器里面那些很好玩的命令縮寫。例如,"sh int" 的意思是 "show interface"。 現在 windows 2000 也有了類似界面的工具,叫做 netsh。
我們在 Windows 2000 的 cmd shell 下,輸入 netsh就出來:netsh> 提示符,輸入 int ip 就顯示:interface ip> 然后輸入 dump ,我們就可以看到當前系統的網絡配置:
# ----------------------------------
# Interface IP Configuration
# ----------------------------------
pushd interface ip
# Interface IP Configuration for "Local Area Connection"
set address name = "Local Area Connection" source = static addr = 192.168.1.168
mask = 255.255.255.0
add address name = "Local Area Connection" addr = 192.1.1.111 mask = 255.255.255.0
set address name = "Local Area Connection" gateway = 192.168.1.100 gwmetric = 1
set dns name = "Local Area Connection" source = static addr = 202.96.209.5
set wins name = "Local Area Connection" source = static addr = none
popd
# End of interface IP configuration 上面介紹的是通過交互方式操作的一種辦法。
我們可以直接輸入命令: "netsh interface ip add address "Local Area Connection" 10.0.0.2 來添加 IP 地址。假如不知道語法,不要緊的哦!在提示符下,輸入 ? 就可以找到答案了。方便不方便啊?原來微軟的東西里面,也有那么一些讓人喜歡的玩意兒。可惜,之至者甚少啊!
255.0.0.0"
Windows網絡命令行程序
這部分包括:
使用 ipconfig /all 查看配置
使用 ipconfig /renew 刷新配置
使用 ipconfig 治理 DNS 和 DHCP 類別 ID
使用 Ping 測試連接
使用 Arp 解決硬件地址問題
使用 nBTstat 解決 NetBIOS 名稱問題
使用 netstat 顯示連接統計
使用 tracert 跟蹤網絡連接
使用 pathping 測試路由器
使用 ipconfig /all 查看配置
發現和解決 TCP/IP 網絡問題時,先檢查出現問題的計算機上的 TCP/IP 配置。可以使用 ipconfig 命令獲得主機配置信息,包括 IP 地址、子網掩碼和默認網關。
注重
對于 Windows 95 和 Windows 98 的客戶機,請使用 winipcfg 命令而不是 ipconfig 命令。
使用帶 /all 選項的 ipconfig 命令時,將給出所有接口的具體配置報告,包括任何已配置的串行端口。使用 ipconfig /all,可以將命令輸出重定向到某個文件,并將輸出粘貼到其他文檔中。也可以用該輸出確認網絡上每臺計算機的 TCP/IP 配置,或者進一步調查 TCP/IP 網絡問題。
例如,假如計算機配置的 IP 地址與現有的 IP 地址重復,則子網掩碼顯示為 0.0.0.0。
下面的范例是 ipconfig /all 命令輸出,該計算機配置成使用 DHCP 服務器動態配置TCP/IP,并使用 WINS 和 DNS 服務器解析名稱。
Windows 2000 IP Configuration
Node Type.. . . . . . . . : Hybrid
IP Routing Enabled.. . . . : No
WINS PRoxy Enabled.. . . . : No
Ethernet adapter Local Area Connection:
Host Name.. . . . . . . . : corp1.microsoft.com
DNS Servers . . . . . . . : 10.1.0.200
Description. . . . . . . : 3Com 3C90x Ethernet Adapter
Physical Address. . . . . : 00-60-08-3E-46-07
DHCP Enabled.. . . . . . . : Yes
Autoconfiguration Enabled.: Yes
IP Address. . . . . . . . . : 192.168.0.112
Subnet Mask. . . . . . . . : 255.255.0.0
Default Gateway. . . . . . : 192.168.0.1
DHCP Server. . . . . . . . : 10.1.0.50
Primary WINS Server. . . . : 10.1.0.101
Secondary WINS Server. . . : 10.1.0.102
Lease Obtained.. . . . . . : Wednesday, September 02, 1998 10:32:13 AM
Lease EXPires.. . . . . . : Friday, September 18, 1998 10:32:13 AM
假如 TCP/IP 配置沒有問題,下一步測試能夠連接到 TCP/IP 網絡上的其他主機。
使用 ipconfig /renew 刷新配置
C:/> ping -n 2 -l 1450 172.16.48.10
Pinging 172.16.48.10 with 1450 bytes of data:
Reply from 172.16.48.10:bytes=1450 time <10ms TTL=32
Reply from 172.16.48.10:bytes=1450 time <10ms TTL=32
Ping statistics for 157.59.8.1:
Packets:Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate roundtrip times in milli-seconds:
Minimum = 0ms, Maximum = 10ms, Average = 2ms
使用 Arp 解決硬件地址問題
“地址解析協議 (ARP)”答應主機查找同一物理網絡上的主機的媒體訪問控制地址,假如給出后者的 IP 地址。為使 ARP 更加有效,每個計算機緩存 IP 到媒體訪問控制地址映射消除重復的 ARP 廣播請求。
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
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 -a
Active Connections
Proto Local Address Foreign Address State
TCP CORP1:1572 172.16.48.10:nbsession ESTABLISHED
TCP CORP1:1589 172.16.48.10:nbsession ESTABLISHED
TCP CORP1:1606 172.16.105.245:nbsession ESTABLISHED
TCP CORP1:1632 172.16.48.213:nbsession ESTABLISHED
TCP CORP1:1659 172.16.48.169:nbsession ESTABLISHED
TCP CORP1:1714 172.16.48.203:nbsession ESTABLISHED
TCP CORP1:1719 172.16.48.36:nbsession ESTABLISHED
TCP CORP1:1241 172.16.48.101: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
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 =
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
使用 tracert 跟蹤網絡連接
Tracert(跟蹤路由)是路由跟蹤實用程序,用于確定 IP 數據報訪問目標所采取的路徑。Tracert 命令用 IP 生存時間 (TTL) 字段和 ICMP 錯誤消息來確定從一個主機到網絡上其他主機的路由。
C:/> tracert 172.16.0.99 -d
Tracing route to 172.16.0.99 over a maximum of 30 hops
1 2s 3s 2s 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.
C:/> tracert 192.168.10.99
Tracing route to 192.168.10.99 over a maximum of 30 hops
1 10.0.0.1 reportsestination net unreachable.
Trace complete.
tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name
使用 pathping 測試路由器
pathping 命令是一個路由跟蹤工具,它將 ping 和 tracert 命令的功能和這兩個工具所不提供的其他信息結合起來。pathping 命令在一段時間內將數據包發送到到達最終目標的路徑上的每個路由器,然后基于數據包的計算機結果從每個躍點返回。由于命令顯示數據包在任何給定路由器或鏈接上丟失的程度,因此可以很輕易地確定可能導致網絡問題的路由器或鏈接。某些選項是可用的,如下表所示。

默認的躍點數是 30,并且超時前的默認等待時間是 3 秒。默認時間是 250 毫秒,并且沿著路徑對每個路由器進行查詢的次數是 100。
以下是典型的 pathping 報告。躍點列表后所編輯的統計信息表明在每個獨立路由器上數據包丟失的情況。 D:/> pathping -n msw
Tracing route to msw [7.54.1.196]
over a maximum of 30 hops:
0 172.16.87.35
1 172.16.87.218
2 192.68.52.1
3 192.68.80.1
4 7.54.247.14
5 7.54.1.196
Computing statistics for 125 seconds...
Source to Here This Node/Link
Hop RTT Lost/Sent = Pct Lost/Sent = Pct Address
0 172.16.87.35
0/ 100 = 0%
1 41ms 0/ 100 = 0% 0/ 100 = 0% 172.16.87.218
13/ 100 = 13%
2 22ms 16/ 100 = 16% 3/ 100 = 3% 192.68.52.1
0/ 100 = 0%
3 24ms 13/ 100 = 13% 0/ 100 = 0% 192.68.80.1
0/ 100 = 0%
4 21ms 14/ 100 = 14% 1/ 100 = 1% 10.54.247.14
0/ 100 = 0%
5 24ms 13/ 100 = 13% 0/ 100 = 0% 10.54.1.196
Trace complete.
當運行 pathping 時,在測試問題時首先查看路由的結果。此路徑與 tracert 命令所顯示的路徑相同。然后 pathping 命令對下一個 125 毫秒顯示忙消息(此時間根據躍點計數變化)。在此期間,pathping 從以前列出的所有路由器和它們之間的鏈接之間收集信息。在此期間結束時,它顯示測試結果。
最右邊的兩欄 This Node/Link Lost/Sent=Pct 和 Address 包含的信息最有用。172.16.87.218(躍點 1)和 192.68.52.1(躍點 2)丟失 13% 的數據包。 所有其他鏈接工作正常。在躍點 2 和 4 中的路由器也丟失尋址到它們的數據包(如 This Node /Link 欄中所示),但是該丟失不會影響轉發的路徑。
對鏈接顯示的丟失率(在最右邊的欄中標記為 )表明沿路徑轉發丟失的數據包。該丟失表明鏈接阻塞。對路由器顯示的丟失率(通過最右邊欄中的 IP 地址顯示)表明這些路由器的 CPU 可能超負荷運行。這些阻塞的路由器可能也是端對端問題的一個因素,尤其是在軟件路由器轉發數據包時。
新聞熱點
疑難解答