我們曾經介紹過一篇關於如何選擇網路故障排除方法的文章,介紹了三種網路故障排除方法。這裡我們又重拾話題,通過具體執行個體助您排除網路故障。
開始以前,先來簡要回顧一下介紹過的三種方法。 >
從下至上的方法:從OSI模型底端開始,順序向上。
從上至下的方法:從OSI模型頂端開始,順序往下。
分而治之的方法:從OSI模型特定層開始,確定問題是在該層、還是上層或下層。
從理論上來理解這些方法是容易的,但是如何在實際應用中運用來解決實際問題呢?來看幾個利用從下至上的以及分而治之方法的執行個體。(因為從上至下的方法實際就是從下至上方法的逆向方法,所以不做介紹。)
從下至上
適用情況:當使用者從遠程地址打來電話說電腦不能工作,他所使用的應用需要網路訪問。
開始:首先查看使用者1層的連通性(如物理層)。例如,可以讓使用者看網線是否與牆上連接埠和裝置相連。對於大部分使用者來說,讓他們去查看交換器連接埠的指示燈狀態要比向他們解釋什麼是網線要容易得多。
在理想情況下,交換器管理良好,有完備的網路記錄文檔。因此,可知道這位使用者使用的牆上插座連接埠號碼為12,而且知道12號口與交換器接線櫃裡11號口相連。 (注意,如果管理員不掌握這些資訊,就需要詢問使用者獲得這些資訊) (學電腦)
方法1:然後,遠程登陸Cisco交換器,使用show ip interface brief命令。可得到列表A的資訊。
列表A
Switch# show ip interface briefInterface IP-Address OK? Method Status ProtocolVlan1 10.1.1.1 YES NVRAM up upFastEthernet0/1 unassigned YES unset up upFastEthernet0/2 unassigned YES unset down downFastEthernet0/3 unassigned YES unset down downFastEthernet0/4 unassigned YES unset down downFastEthernet0/5 unassigned YES unset down downFastEthernet0/6 unassigned YES unset down downFastEthernet0/7 unassigned YES unset down downFastEthernet0/8 unassigned YES unset down downFastEthernet0/9 unassigned YES unset up upFastEthernet0/10 unassigned YES unset up upFastEthernet0/11 unassigned YES unset down downFastEthernet0/12 unassigned YES unset up upFastEthernet0/13 unassigned YES unset up upFastEthernet0/14 unassigned YES unset up upFastEthernet0/15 unassigned YES unset down downFastEthernet0/16 unassigned YES unset down downFastEthernet0/17 unassigned YES unset down downFastEthernet0/18 unassigned YES unset down downFastEthernet0/19 unassigned YES unset down downFastEthernet0/20 unassigned YES unset down downFastEthernet0/21 unassigned YES unset down downFastEthernet0/22 unassigned YES unset down downFastEthernet0/23 unassigned YES unset up upFastEthernet0/24 unassigned YES unset up upSwitch#
通過查看這個輸出,我們可以發現FastEthernet0/11連接埠沒有工作。由於這屬於第一層故障,所以讓使用者順著PC的網卡上的網線找到交換器連接埠。
方法2:如果不是這個問題怎麼辦?如果使用者使用的是14號連接埠又該怎麼辦?既然有串連,說明網是通的。下一步應該怎麼辦?在交換器上使用show interface fastethernet 0/14 命令。顯示如表B所列。
列表B
Switch# show interface fa0/14FastEthernet0/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 outSwitch#
通過表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/14Building configuration...Current configuration : 82 bytesinterface FastEthernet0/14switchport mode accessspanning-tree portfastendSwitch#
儘管可能還有第二層別的問題存在,至少在這一層看起來情況還不錯。接下來,查看第三層。在PC上使用IPCONFIG /ALL命令進行檢查,如列表C列所示。
列表C
C:\> ipconfig /allWindows 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.comEthernet 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.comServer: dns.TechRepublic.comAddress: 10.2.1.26Non-authoritative answer:Name: c10-sha-redirect-lb.cnet.comAddress: 216.239.115.148Aliases: www.techrepublic.com
這表示DNS確實在工作,所以還要繼續查看。
方法2:使用者所要訪問的網站是否存在於本地或者遠端子網?就象互連網網站一樣,我們稱它為外部子網。
既然有些串連以及其它應用還可以使用,我們可以查看第三層,網路層。我們使用ipconfig命令來查看默然網關是否是10.80.2.1。現在需要ping預設閘道。如下面的例子。
C:\> ping 10.80.2.1Pinging 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 briefInterface IP-Address OK? Method Status ProtocolSerial3/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 downRouter#
通過這一輸出結果,我們可以確定連線路由器和本地交換器的網線沒有串連。我們曾經以為是第三層出了問題,但是實際上問題出在第一層。
在我看來,分而治之的方法需要更多網路和故障排除的知識。但是,這種發法也是發現問題最快的方法。使用故障排除方法類似於使用訪問列表,一旦發現相符合的情況,就沒有必要繼續追查。