領測軟件測試網
我們曾經介紹過一篇關于如何選擇網絡故障排除方法的文章,介紹了三種網絡故障排除方法。這里我們又重拾話題,通過具體實例助您排除網絡故障。
開始以前,先來簡要回顧一下介紹過的三種方法。 >
從下至上的方法:從OSI模型底端開始,順序向上。
從上至下的方法:從OSI模型頂端開始,順序往下。
分而治之的方法:從OSI模型特定層開始,確定問題是在該層、還是上層或下層。
從理論上來理解這些方法是容易的,但是如何在實際應用中運用來解決實際問題呢?來看幾個利用從下至上的以及分而治之方法的實例。(因為從上至下的方法實際就是從下至上方法的逆向方法,所以不做介紹。)
從下至上
適用情況:當用戶從遠程地址打來電話說電腦不能工作,他所使用的應用需要網絡訪問。
開始:首先查看用戶1層的連通性(如物理層)。例如,可以讓用戶看網線是否與墻上端口和設備相連。對于大部分用戶來說,讓他們去查看交換機端口的指示燈狀態要比向他們解釋什么是網線要容易得多。
在理想情況下,交換機管理良好,有完備的網絡記錄文檔。因此,可知道這位用戶使用的墻上插座端口號為12,而且知道12號口與交換機接線柜里11號口相連。 (注意,如果管理員不掌握這些信息,就需要詢問用戶獲得這些信息)
方法1:然后,遠程登陸Cisco交換機,使用show ip interface brief命令?傻玫搅斜鞟的信息。
列表A
Switch# show ip interface brief
Interface IP-Address OK? Method Status Protocol
Vlan1 10.1.1.1 YES NVRAM up up
FastEthernet0/1 unassigned YES unset up up
FastEthernet0/2 unassigned YES unset down down
FastEthernet0/3 unassigned YES unset down down
FastEthernet0/4 unassigned YES unset down down
FastEthernet0/5 unassigned YES unset down down
FastEthernet0/6 unassigned YES unset down down
FastEthernet0/7 unassigned YES unset down down
FastEthernet0/8 unassigned YES unset down down
FastEthernet0/9 unassigned YES unset up up
FastEthernet0/10 unassigned YES unset up up
FastEthernet0/11 unassigned YES unset down down
FastEthernet0/12 unassigned YES unset up up
FastEthernet0/13 unassigned YES unset up up
FastEthernet0/14 unassigned YES unset up up
FastEthernet0/15 unassigned YES unset down down
FastEthernet0/16 unassigned YES unset down down
FastEthernet0/17 unassigned YES unset down down
FastEthernet0/18 unassigned YES unset down down
FastEthernet0/19 unassigned YES unset down down
FastEthernet0/20 unassigned YES unset down down
FastEthernet0/21 unassigned YES unset down down
FastEthernet0/22 unassigned YES unset down down
FastEthernet0/23 unassigned YES unset up up
FastEthernet0/24 unassigned YES unset up up
Switch#
|
通過查看這個輸出,我們可以發現FastEthernet0/11端口沒有工作。由于這屬于第一層故障,所以讓用戶順著PC的網卡上的網線找到交換機端口。
方法2:如果不是這個問題怎么辦?如果用戶使用的是14號端口又該怎么辦?既然有連接,說明網是通的。下一步應該怎么辦?在交換機上使用show interface fastethernet 0/14 命令。顯示如表B所列。
列表B
Switch# show interface fa0/14
FastEthernet0/14 is up, line protocol is up (connected)
Hardware is Fast Ethernet, address is 0014.1c40.b08e (bia 0014.1c40.b08e)
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Half-duplex, 100Mb/s, media type is 100BaseTX
input flow-control is unsupported output flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 2000 bits/sec, 3 packets/sec
96848 packets input, 8083322 bytes, 0 no buffer
Received 9293 broadcasts (0 multicast)
0 runts, 0 giants, 0 throttles
323210 input errors, 123123 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 133 multicast, 0 pause input
0 input packets with dribble condition detected
10061627 packets output, 866400040 bytes, 0 underruns
0 output errors, 0 collisions, 2 interface resets
0 babbles, 0 late collision, 2 deferred
132 lost carrier, 20 no carrier, 0 PAUSE output
0 output buffer failures, 0 output buffers swapped out
Switch#
|
通過表B,我們可以發現盡管網絡可以連接,但存在一些第一層的問題。
方法3:如果這個端口有網絡連接而且沒有問題該怎么辦呢?接下來就應該查看第二層。請看例子
Switch#show mac address-table interface fastEthernet 0/14
硬件地址表
Vlan 硬件地址 類型 端口號
1 00c0.b768.5409 DYNAMIC Fa0/14
Total Mac Addresses for this criterion: 1
Switch#
如果這一信息符合PC上的MAC地址,接下來就要確定交換機端口上沒有不相關的配置。例如:
Switch# show run interface fa0/14
Building configuration...
Current configuration : 82 bytes
interface FastEthernet0/14
switchport mode access
spanning-tree portfast
end
Switch#
|
盡管可能還有第二層別的問題存在,至少在這一層看起來情況還不錯。接下來,查看第三層。在PC上使用IPCONFIG /ALL命令進行檢查,如列表C列所示。
列表C
C:\> ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : PC100
Primary Dns Suffix . . . . . . . : TechRepublic.com
Node Type . . . . . . . . . . . . : Peer-Peer
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : TechRepublic.com
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : TechRepublic.com
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
Physical Address. . . . . . . . . : 00-C0-B7-68-54-09
Dhcp Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IP Address. . . . . . . . . . . . : 10.80.2.2
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . : 10.80.2.1
DHCP Server . . . . . . . . . . . : 10.2.1.26
DNS Servers . . . . . . . . . . . : 10.2.1.26
Primary WINS Server . . . . . . . : 10.2.1.26
Secondary WINS Server . . . . . . : 10.2.1.21
Lease Obtained. . . . . . . . . . : Wednesday, November 02, 2005 5:43:55 AM
Lease Expires . . . . . . . . . . : Thursday, November 10, 2005 5:43:55 AM
|
這里,我們可以看到PC有IP地址,但是這地址對么?這臺PC通過DHCP獲得10.80.x.x范圍內的地址,但是現在地址卻是10.1.x.x。
所以,我們終于發現了問題。DHCP服務器分發的IP地址不屬于子網。這種問題多出現在PC從某個子網挪到另一個子網時,PC依然請求舊的IP地址就產生了問題。
可以嘗試這樣解決問題,讓所有接口的租用IP地址重新交付給DHCP服務器(即歸還IP地址)。使用IPCONFIG /RELEASE,然后使用IPCONFIG /RENEW命令,然后PC就會獲得正確的IP地址,所有的網絡應用就都可以使用了。
分而治之
假設情況:某個用戶說所有的應用除了IE瀏覽器都可以使用。當嘗試瀏覽網頁時,出現“找不到主機或DNS錯誤,網頁無法顯示”的提示。
如何開始:由于是跟應用相關的問題,可能會想采用從上到下的方法從OSI模型的應用層查起。但是,其實有多種原因可能造成這種錯誤。
采用分而治之的方法,先從我們了解的情況入手。用戶說除IE外其他應用都可以工作。問題可能就出現在本地網和外網。
方法1: 既然錯誤報告提到了DNS, 可以將它看做DNS問題。既然其他應用依然工作,也許存在有一臺本地DNS服務器給局域網應用提供服務。
為了檢測這一理論,我們可以使用nslookup命令來確定DNS是否在工作。例子如下:
C:\> nslookup www.techrepublic.com
Server: dns.TechRepublic.com
Address: 10.2.1.26
Non-authoritative answer:
Name: c10-sha-redirect-lb.cnet.com
Address: 216.239.115.148
Aliases: www.techrepublic.com
|
這表示DNS確實在工作,所以還要繼續查看。
方法2:用戶所要訪問的網站是否存在于本地或者遠程的子網?就象互聯網網站一樣,我們稱它為外部子網。
既然有些連接以及其它應用還可以使用,我們可以查看第三層,網絡層。我們使用ipconfig命令來查看默然網關是否是10.80.2.1,F在需要ping默認網關。如下面的例子。
C:\> ping 10.80.2.1
Pinging 10.80.2.1 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 10.80.2.1:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
|
從這里,我們可以確定第三層存在問題。默然網關停用或者不可達。
如果所處位置是中央數據中心,遠程登陸用戶默認網關。登陸以后,使用show ip interface brief命令,如列表D所示。
列表D
Router# show ip interface brief
Interface IP-Address OK? Method Status Protocol
Serial3/0 unassigned YES NVRAM up up
Serial3/0.1 10.80.100.2 YES NVRAM up up
Serial3/0.2 10.80.100.6 YES NVRAM up up
BRI3/0 unassigned YES NVRAM up up
BRI3/0:1 unassigned YES unset down down
BRI3/0:2 unassigned YES unset down down
Dialer1 10.80.100.10 YES NVRAM up up
Loopback1 unassigned YES NVRAM up up
Ethernet3/0 10.80.2.1 YES NVRAM down down
Router#
|
通過這一輸出結果,我們可以確定連接路由器和本地交換機的網線沒有連接。我們曾經以為是第三層出了問題,但是實際上問題出在第一層。
在我看來,分而治之的方法需要更多網絡和故障排除的知識。但是,這種發法也是發現問題最快的方法。使用故障排除方法類似于使用訪問列表,一旦發現相符合的情況,就沒有必要繼續追查。
文章來源于領測軟件測試網 http://www.kjueaiud.com/