懒得装linux,把别的电脑上的虚拟机做的linux硬盘文件拷到自己电脑上使用,却发现无法联网。
debian:~# ifconfig
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:66 errors:0 dropped:0 overruns:0 frame:0
TX packets:66 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5104 (4.9 KiB) TX bytes:5104 (4.9 KiB)
没有了eth0接口,查看/etc/network/interfaces
debian:~# 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
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.190
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 61.128.114.133 61.128.114.166
有eth0的配置,再次ifconfig -a 加-a可以查看所有的接口,不加参数只能查看活动接口。
发现有eth1,eth0没了,这应该是我的虚拟机把网卡认成了eth1,而原来的虚拟机把网卡作为eth0的,导致没有eth1的配置,无法联网,
于是修改/etc/network/interfaces把eth1换成eth1,ifup eth1,还是不行,/etc/init.d/networking restart也不行,reboot,呵呵好了。