日期:2014-05-16  浏览次数:21172 次

VMware 6 上安装完Linux后,无法通过DHCP动态获得地址
VMware 6 上安装完Linux后,无法通过DHCP动态获得地址,网络也就无法使用;但如果使用静态地址,网络又可以使用了。

Vmware使用的是“桥接”的方式

使用动态地址时,使用Ifconfig eth0查看网络接口如下:

[root@localhost root]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:15:E6:CC
  UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  RX packets:370 errors:0 dropped:0 overruns:0 frame:0
  TX packets:401 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:100
  RX bytes:278462 (271.9 Kb) TX bytes:58240 (56.8 Kb)
  Interrupt:10 Base address:0x2024
没有IP地址
Ping 外部地址:
[root@localhost root]# ping 61.139.2.69
connect: Network is unreachable

将Eth0 down掉后再up起来,然后用dhclient eth0获取地址,仍然无效:
[root@localhost root]# ifconfig eth0 down
[root@localhost root]# ifconfig eth0 up
[root@localhost root]# dhclient eth0
Internet Software Consortium DHCP Client V3.0pl1
Copyright 1995-2001 Internet Software Consortium.
All rights reserved.
For info, please visit http://www.isc.org/products/DHCP

Listening on LPF/eth0/00:0c:29:15:e6:cc
Sending on LPF/eth0/00:0c:29:15:e6:cc
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 14
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 13
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 9
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
还是获得不了地址!!郁闷
--------------------------
将网卡绑上静态IP
[root@localhost root]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:15:E6:CC
  inet addr:10.0.0.8 Bcast:10.255.255.255 Mask:255.0.0.0
  UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  RX packets:378 errors:0 dropped:0 overruns:0 frame:0
  TX packets:421 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:100
  RX bytes:278942 (272.4 Kb) TX bytes:63880 (62.3 Kb)
  Interrupt:10 Base address:0x2024

[root@localhost root]# ping 61.139.2.69
PING 61.139.2.69 (61.139.2.69) from 10.0.0.8 : 56(84) bytes of data.
64 bytes from 61.139.2.69: icmp_seq=1 ttl=249 time=58.1 ms
64 bytes from 61.139.2.69: icmp_seq=2 ttl=249 time=375 ms
64 bytes from 61.139.2.69: icmp_seq=3 ttl=249 time=13.4 ms

--- 61.139.2.69 ping statistics ---
3 packets transmitted, 3 received, 0% loss, time 2007ms
rtt min/avg/max/mdev = 13.464/149.083/375.620/161.222 ms
静态IP下网络就OK了!

请高手指点一下,如何搞定DHCP啊?为什么获得不到地址呢?

------解决方案--------------------
Bridged 需要手动指定 IP 

NAT 可以用 DHCP,也可以用 手动指定
------解决方案--------------------
使用自动获取IP必须装上vmtools啊,你先装上他再说啊,我的就是 啊!!!
------解决方案--------------------
NAT方式就可以
------解决方案--------------------

看看vmware 的网卡参数,有关dhcp的设置好。一般,vmware 提供8个虚拟网卡,用其中两个就行啦,一个设置成NAT方式,一个设置成brige方式。