虚拟机中的kali linux没有了eth0,只有lo接口了怎么办

问题如下:,没有了eth0

1
2
3
4
5
6
7
8
9
[email protected]:~# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 70 bytes 3638 (3.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 70 bytes 3638 (3.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

首先启动eth0

1
ifconfig eth0 up

之后在/etc/network/interfaces文件中加入

1
iface eth0 inet dhcp

最后重启网络

1
service networking restart

或者interfaces写成静态ip也行

1
2
3
iface eth0 inet static
address 192.168.145.134
netmask 255.255.255.0
1元也是爱,谢谢支持