1. 程式人生 > >虛擬機器網路配置中的一些疑難問題---在實驗室遇到了Destination Host Unreachable

虛擬機器網路配置中的一些疑難問題---在實驗室遇到了Destination Host Unreachable

csdn的新版的部落格速度很快啊。下午本打算nfs一下板子的,發現找不到虛擬機器。測試了下虛擬機器的網路情況:[email protected]:/nfsboot/etc# ping 202.193.89.254  這個閘道器不可達。
PING 202.193.89.254 (202.193.89.254) 56(84) bytes of data.
From 202.193.89.253 icmp_seq=1 Destination Host Unreachable
From 202.193.89.253 icmp_seq=2 Destination Host Unreachable
From 202.193.89.253 icmp_seq=3 Destination Host Unreachable
From 202.193.89.253 icmp_seq=4 Destination Host Unreachable
From 202.193.89.253 icmp_seq=5 Destination Host Unreachable
域名伺服器也不可達。真是奇怪了。
[email protected]:/nfsboot/etc# ping 202.193.80.33
PING 202.193.80.33 (202.193.80.33) 56(84) bytes of data.
From 202.193.89.253 icmp_seq=1 Destination Host Unreachable
From 202.193.89.253 icmp_seq=2 Destination Host Unreachable
From 202.193.89.253 icmp_seq=3 Destination Host Unreachable
From 202.193.89.253 icmp_seq=4 Destination Host Unreachable
From 202.193.89.253 icmp_seq=5 Destination Host Unreachable
From 202.193.89.253 icmp_seq=6 Destination Host Unreachable
修改interfaces,死活不能auto聯網。參考瞭如下資料,發現自己的聯網方式是對的。http://bbs.sciencenet.cn/home.php?COLLCC=2420443621&mod=space&uid=230547&do=blog&id=250085

http://www.phpweblog.net/fuyongjie/archive/2008/08/27/5670.aspx

http://www.howtogeek.com/howto/ubuntu/change-ubuntu-server-from-dhcp-to-a-static-ip-address/
但為啥自動dhcp不行呢!??
[email protected]
:/etc# /etc/init.d/networking restart
 * Reconfiguring network interfaces...                                          Internet Systems Consortium DHCP Client 


V3.1.3
Copyright 2004-2009 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/


Listening on LPF/eth0/00:0c:29:da:ff:a7
Sending on   LPF/eth0/00:0c:29:da:ff:a7
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 17
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 12
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11
No DHCPOFFERS received.   找不到DHCP伺服器吧。這個需要我指定不?
No working leases in persistent database - sleeping.
                                                                         [ OK ]

[email protected]:/etc# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0c:29:da:ff:a7  
          inet addr:202.193.89.249  Bcast:202.193.89.255  Mask:255.255.255.192
          inet6 addr: fe80::20c:29ff:feda:ffa7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:96 errors:0 dropped:0 overruns:0 frame:0
          TX packets:822 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:12066 (12.0 KB)  TX bytes:34956 (34.9 KB)
          Interrupt:19 Base address:0x2024 


lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:841 errors:0 dropped:0 overruns:0 frame:0
          TX packets:841 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:89396 (89.3 KB)  TX bytes:89396 (89.3 KB)
248也是required time out驚訝的發現252,居然有:C:\Documents and Settings\Administrator>ping 202.193.89.252


Pinging 202.193.89.252 with 32 bytes of data:


Reply from 202.193.89.252: bytes=32 time<1ms TTL=64
Reply from 202.193.89.252: bytes=32 time<1ms TTL=64
Reply from 202.193.89.252: bytes=32 time<1ms TTL=64
Reply from 202.193.89.252: bytes=32 time<1ms TTL=64


Ping statistics for 202.193.89.252:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms


C:\Documents and Settings\Administrator>
難道是ip被佔用了?xp上ping的話,是required time out。這個ip不存在麼?C:\Documents and Settings\Administrator>ping 202.193.89.192


Pinging 202.193.89.192 with 32 bytes of data:


Destination specified is invalid.
Destination specified is invalid.
Destination specified is invalid.
Destination specified is invalid.


=================================================icmp的報文,Destination Host Unreachable的意思如下:The error message "Destination Host Unreachable " tells that the ping request from our computer cannot find the route to the destination IP address(destination network device). It means the Packet send from your computer reached the destination network successfully but it failed to find the destination host. Destination host can be any networking device (with one unique IP address) in the destination network. One major possibility for this error is there is no route for the packet send from your computer to destination host. If there is no route available, it is impossible to find the destination host and your computer will get an error message "Destination host unreachable" instead of replies. So the issue can be due to faulty routing table. If the destination host is down at the time the packet send, it may result destination host unreachable error message. So here I conclude all possible reasons for Destination host unreachable error message with possible troubleshooting steps.


THE POSSIBLE REASONS FOR THE ERROR DESTINATION HOST UNREACHABLE




1. The ping packet find the destination network but failed to find the destination computer in that network.

2.Packet Routing issue.

3. Destination host might be down
意思是到了對方的網路,但是路由器不能轉發報文給目的主機。也就是說知道這個ip在網路上,但是不能傳送資料。好奇怪啊。

=================

xp上ping 的,我虛擬機器之前用的是253.昨天就是這個可用。這次ping一下,是另外一個地址。好奇怪啊。而且不是這個網路中的。學校的 閘道器應該用了很久了。而且是外網ip。

我的實際ip是這個。但是我被254分配的ip是203,好奇怪啊。這個是怎麼個訪問外網法。


這個ip是存在的。


========================

真是搞不懂學校的網路。

虛擬機器上設定網路,dhcp不行。我是bridge的。dhcp方式,是不是還涉及到vmware網絡卡的問題呢?

設定為靜態ip還是可行的。方法可以參考上面的幾個連結。

  1 # The primary network interface
  2 auto eth0
  3 iface eth0 inet static
  4 address 202.193.89.249
  5 netmask 255.255.255.192
  6 gateway 202.193.89.254
  7 #iface eth0 inet dhcp  這個是dhcp的方式。上面的是static ip的方式。
  8 auto lo
  9 iface lo inet loopback
 10 #auto eth0
 11 #iface eth0 inet dhcp
~                               

===================

destination host unreachable   
目標主機不能到達
“Destination Host Unreachable”資訊說明對方主機不存在或者沒有跟對方建立連線。 網線沒接好,或者網絡卡有問題!
檢查物理連線,重啟機子 一般在確定你的TCP/IP網路屬性的設定正確下,檢查你的網線或者網絡卡是不是沒插好
我想應該是物理連線方面沒接好吧。。。   
機子已經用了好幾年了,N多灰塵。。。

  
路由表中連到達目標的路由都沒有,會出現“Destination Host Unreachable”。
主要在以下三種情形出現:
1、 區域網使用DHCP動態分配IP地址時,DHCP出現故障或者失敗
DHCP失效或者出現故障時,客戶機無法分配到IP地址,系統只有自設IP地址,而IP地址的自動設定往往會分配到不同的子網,因此會出現“Destination Host Unreachable”。

2、 子網掩碼設定錯誤 
這種情況一般比較少見,如果子網掩碼不是系統自動生成的,則在計算時一定細心。

3、 路由表返回錯誤資訊 
這種情況一般是在“Destination Host Unreachable”前面加上IP地址,說明本地計算機與外部網路連線沒有問題,但與某臺主機連線存在問題。

"Destination Net Unreachable"這個資訊表示對方主機不存在或者沒有跟對方建立連線。這裡要說明一下"destination host unreachable"和"time out"的區別,如果所經過的路由器的路由表中具有到達目標的路由,而目標因為其它原因不可到達,這時候會出現"time out",如果路由表中連到達目標的路由都沒有,那就會出現"destination host unreachable"。

把icmp安全策略關閉
tcp/IP屬性——高階——選項——IP安全機制屬性——選擇"不使用IPSEC"確定,OK了,一切正常

ping 時出request time out 和destination is unreachable

request time out 是指icmp包發出後,長時間沒有迴應,所以會產生request time out一般是ping 了一臺網路中不存在的主機。 
destination is unreachable 或 destination port unreachable 一般是收到了目標主機或中間路由器迴應的埠或目標主機不可達icmp包 
如你ping一臺用iptables封了icmp包的主機且用了-j REJECT 就會出現destination port unreachable 的資訊,這是目標主機給的迴應。 
兩者主要的區別是看目標主機或中間路由器是不是給了icmp不可達的迴應。 向目標主機發ip資料報,如果協議項是錯的,或協議項不可用。目標將返回destination is unreachable的icmp報文。如果有防火牆,可能過濾掉ip資料報,收不到迴應報文。如果設定ip頭部協議內容為一特別大的數字(至少在今天還沒有被使用),應該主機一定會返回unreachable的icmp報文。否則一定有防火牆。也可以變化ip中的協議項來探測主機使用了哪些協議,如果沒使用則返回unreachable的icmp報文。
============================================

安裝了虛擬機器後,總結了下面三個遇到的問題:

一、問題一:虛擬機器和主機互ping不通

安裝了虛擬機器,乙太網選的是預設的橋接,可安裝完後,不能和主機ping通,也不能ping通閘道器192.168.1.1,顯示"destination host unreachable"

在VMware Workstation中,單擊選單編輯->虛擬網路設定(S),開啟"虛擬網路編輯器",在"摘要"選項卡中,可看到:
虛擬網路               摘要
VMnet0(橋接)      橋接到ADMtek AN983 10/100 PCI Adapter - 資料包計劃程式微型埠
VMnet1(僅主機)    一個私有網路和主機相連
VMnet8(NAT)       用於共享主機的IP地址

由於我們在乙太網“網路連線”中選擇的是“橋接”,故切換到"主機虛擬網路對映",看到"VMnet0"後面的值為:橋接到一個自動選擇的介面卡,我們將其修改為:
ADMtek AN983 10/100 PCI Adapter - 資料包計劃程式微型埠
然後"應用"->"確定"

結果:主機能ping通虛擬機器,而虛擬機器卻ping不通主機,但主機和虛擬機器均能ping通局域網裡其他計算機.
後來,將主機"網路連線"中的VMware Network Adapter VMnet1、VMware Network Adapter VMnet8禁用,虛擬機器就可以ping通主機了。
這次,終於認真學習了虛擬機器中這三種連線的不同了:

1.Bridge模式(橋接模式)
    這種模式是在新建虛擬機器的時候預設選擇的,是將虛擬主機的虛擬網絡卡橋接到一個Host主機的物理網絡卡上面實際上是將Host主機的物理網絡卡設定為混雜模式,從而達到偵聽多個IP的能力。在這種模式下,虛擬主機的虛擬網絡卡直接與Host主機的物理網絡卡所在的網路相連,可以理解為虛擬機器和Host主機處於對等的地位,在網路關係上是平等的,沒有誰主誰次、誰前誰後之分。

2.NAT模式
    這種模式下Host主機的“網路連線”中會出現了一個虛擬的網絡卡VMnet8(預設情況下)。如果你做過2000/2003的NAT伺服器的實驗就會理解:Host主機上的VMnet8虛擬網絡卡就相當於連線到內網的網絡卡,Host主機上的物理網絡卡就相當於連線到外網的網絡卡,而虛擬機器本身則相當於執行在內網上的計算機,虛擬機器內的虛擬網絡卡則獨立於Virtual Ethernet Switch(VMnet8)。在這種方式下,VMware自帶的DHCP服務會預設地載入到Virtual Ethernet Switch(VMnet8)上,這樣虛擬機器就可以使用DHCP服務。

3.Host-Only模式
   這種模式是一種封閉的方式,適合在一個獨立的環境中進行各種網路實驗。這種方式下Host主機的“網路連線”中出現了一個虛擬的網絡卡VMnet1(預設情況下)。和NAT唯一的不同的是:此種方式下,沒有地址轉換服務。因此這種情況下,虛擬機器只能訪問到主機,這也是Host-Only的名字的意義。

二、問題二:虛擬機器不能使用小鍵盤中的數字鍵?

先在主機關閉小鍵盤中的使用(按下NumLock鍵,使指示燈不亮),然後在虛擬機器中按下NumLock鍵,使指示燈變亮即可。

三、主機和虛擬機器共享檔案

方法1:可給虛擬機器安裝VMware Tools,VMware Workstation->選單“虛擬機器”->“安裝VMware工具(I)”,則進行自動安裝VMware Tools,安裝完成後,即可直接在主機中向虛擬機器拖動檔案。

方法2:主機和虛擬機器開共享.可通過直接訪問另一臺計算機也可通過IPC$連線拷貝檔案。

==========================================================

看到以上這個文章之後,我明白橋接不需要vmnet8,也不需要vmnet1,所以禁用了8和1,還有個virtualbox的網路連線,馬上就好了。


改回253了。

[email protected]:/etc/init.d# ./networking
Usage: /etc/init.d/networking {start|stop|restart|force-reload}
[email protected]:/etc/init.d# ./networking restart
 * Reconfiguring network interfaces...     

板子NFS啟動成功!

eth0: link down                                                                 
IP-Config: Complete:                                                            
     device=eth0, addr=202.193.89.251, mask=255.255.255.192, gw=202.193.89.254, 
     host=202.193.89.251, domain=, nis-domain=(none),                           
     bootserver=202.193.89.253, rootserver=202.193.89.253, rootpath=            
Looking up port of RPC 100003/2 on 202.193.89.253                               
eth0: link up, 100Mbps, full-duplex, lpa 0x41E1                                 
Looking up port of RPC 100005/1 on 202.193.89.253                               
VFS: Mounted root (nfs filesystem).                                             
Freeing init memory: 152K                                                       
ENDRCS--CALL-MKFSAUTO-Imount SD card begin ....                                 
mount SD card end ....                                                          
CALL-FORTry to bring eth0 interface up......use /etc/eth0-setting as default ..d
/etc/init.d/ifconfig-eth0: line 32: telnetd: not found                          
IFCONFIGETHO-Done                                                               
Please press Enter to activate this console.                                    
[[email protected] /]#