转移自之前的博客
或许是因为复习时不怎么使用虚拟机,导致网络的某些配置出现了问题,按照网上的各种方法怎么也搞不好,历经小半天,终于解决。方法如下:

1.到根目录下/etc/network找到interfaces文件

2.

vi打开:vi interfaces

此时发现,只有两行:

1
2
auto lo
iface lo inet loopback

之所以不能联网是因为这个文件不完整。

讲这两行替换为:

1
2
3
4
5
6
7
8
9
10
11
12
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet dhcp
auto eth2
iface eth2 inet dhcp
auto ath0
iface ath0 inet dhcp
auto wlan0
iface wlan0 inet dhcp

3.退出vi,启动项 /etc/init.d/networking,重启网络连接sudo /etc/init.d/networking restart,就ok了