重装Vmware造成Ubuntu网络问题


今天重装了vmware后,再次使用原来的Ubuntu7.10文件,找不到网络连接。

web@Ubuntu8:~$ ifconfig
eth1 Link encap:Ethernet HWaddr 00:0C:29:ED:F3:C2
inet addr:0 Bcast:0 Mask:0
Interrupt:16 Base address:0x2000

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:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

sudo vim /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp
原来是新旧vmware的网卡不一样,将eth0改为eth1,重启网络
sudo /etc/init.d/networking restart
一切OK了

顺便讲一下/etc/network/interfaces
如果是配置eth为静态IP
(比如192.168.1.1)并且指定网关(如192.168.1.254),那么如此配置:
auth eth0
iface eth0 inet staticaddress 192.168.1.1
netmask 255.255.255.0
gateway 192.168.1.254
如果是手动指定IP并且还需要访问互联网,比如wget下载,那么还需要设置DNS:
$sudo pico /etc/resolv.conf向这里添加配置内容:nameserver xxx.xxx.xxx.xxx保存即可。

相关内容