虚拟机网络配置中的一些疑难问题---在实验室遇到了Destination Host Unreachable

csdn的新版的博客速度很快啊。

下午本打算nfs一下板子的,发现找不到虚拟机。

测试了下虚拟机的网络状况:
root@ubuntu:/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

域名服务器也不可达。真是奇怪了。
root@ubuntu:/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不行呢!??
root@ubuntu:/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 ]




root@ubuntu:/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在网络上,可是不能发送数据。好奇怪啊。

=================php



xp上ping 的,我虚拟机以前用的是253.昨天就是这个可用。
此次ping一下,是另一个地址。好奇怪啊。并且不是这个网络中的。


学校的 网关应该用了好久了。并且是外网ip。





个人实际ip是这个。可是我被254分配的ip是203,好奇怪啊。这个是怎么个访问外网法。html



这个ip是存在的。web



========================ubuntu

真是搞不懂学校的网络。c#


虚拟机上设置网络,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
~                               
网络

===================dom

destination host unreachable   
目标主机不能到达
“Destination Host Unreachable”信息说明对方主机不存在或者没有跟对方创建链接。 网线没接好,或者网卡有问题!
检查物理链接,重启机子 通常在肯定你的TCP/IP网络属性的设置正确下,检查你的网线或者网卡是否是没插好
我想应该是物理链接方面没接好吧。。。   
机子已经用了好几年了,N多灰尘。。。

  
路由表中连到达目标的路由都没有,会出现“Destination Host Unreachable”。
主要在如下三种情形出现:
一、 局域网使用DHCP动态分配IP地址时,DHCP出现故障或者失败
DHCP失效或者出现故障时,客户机没法分配到IP地址,系统只有自设IP地址,而IP地址的自动设置每每会分配到不一样的子网,所以会出现“Destination Host Unreachable”。

二、 子网掩码设置错误 
这种状况通常比较少见,若是子网掩码不是系统自动生成的,则在计算时必定细心。

三、 路由表返回错误信息 
这种状况通常是在“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报文。
============================================

安装了虚拟机后,总结了下面三个遇到的问题:tcp

1、问题一:虚拟机和主机互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 VMnet一、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的名字的意义。

2、问题二:虚拟机不能使用小键盘中的数字键?

先在主机关闭小键盘中的使用(按下NumLock键,使指示灯不亮),而后在虚拟机中按下NumLock键,使指示灯变亮便可。

3、主机和虚拟机共享文件

方法1:可给虚拟机安装VMware Tools,VMware Workstation->菜单“虚拟机”->“安装VMware工具(I)”,则进行自动安装VMware Tools,安装完成后,便可直接在主机中向虚拟机拖动文件。

方法2:主机和虚拟机开共享.可经过直接访问另外一台计算机也可经过IPC$链接拷贝文件。

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/nellson/archive/2010/07/04/5711620.aspx

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

看到以上这个文章以后,我明白桥接不须要vmnet8,也不须要vmnet1,因此禁用了8和1,还有个virtualbox的网络链接,立刻就行了。




改回253了。

root@ubuntu:/etc/init.d# ./networking
Usage: /etc/init.d/networking {start|stop|restart|force-reload}
root@ubuntu:/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.                                     [root@Real6410 /]#