Debian虚拟机无网卡解决方案
Debian虚拟机没有网卡无法联网
打开/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
auto eth0
iface eth0 inet static
address 192.168.1.199
netmask 255.255.255.0
gatway 192.168.1.1
如果dhcp
iface eth0 inet dhcp
网关
/etc/resolv.conf
nameserver 192.168.1.1
nameserver 0.0.0.0
/etc/init.d/networking restart
使用dmesg命令查看我们网卡信息
失败,查看原因,找不到driver,eth0执行
dmesg | grep eth
[5.715564] e1000 0000:02:01.0 eth0: (PCI:66MHz:32-bit) 00:0c:29:7d:bf:43
[5.715573] e1000 0000:02:01.0 eth0: Intel(R) PRO/1000 Network Connection
[5.719709] e1000 0000:02:01.0 ens33: renamed from eth0
所以改成ens33就行了
root@debian:~# lspci | grep -i ethernet
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
root@debian:~# lsmod | grep e1000
e1000 86156 0 //这里提示网卡已经加载到内核中
下面这条命令非常的有效,查看我们的网卡驱动程序在哪里:
root@debian:~# modinfo e1000
filename: /lib/modules/5.10.0-9-amd64/kernel/drivers/net/ethernet/intel/e1000/e1000.ko
license: GPL v2
description: Intel(R) PRO/1000 Network Driver
author: Intel Corporation, <linux.nics@intel.com>
........................
Linux网卡命名enp3s0说明
Ubuntu 16的更新幅度很大,当属systemd替换掉了initd来引导系统这个动作给用户带来的影响最大,
原来习惯service什么的来控制系统服务什么的,现在竟然被systemctl这个命令替换了(虽然service依旧可用)。
systemd带来的另外一个副作用(或者可以说是优点)就是网络接口的命名方式变了:
/*
* Two character prefixes based on the type of interface:
* en — Ethernet
* sl — serial line IP (slip)
* wl — wlan
* ww — wwan
*
* Type of names:
* b<number> — BCMA bus core number
* c<bus_id> — CCW bus group name, without leading zeros [s390]
* o<index>[d<dev_port>] — on-board device index number
* s<slot>[f<function>][d<dev_port>] — hotplug slot index number
* x<MAC> — MAC address
* [P<domain>]p<bus>s<slot>[f<function>][d<dev_port>]
* — PCI geographical location
* [P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]
* — USB port number chain
*/
上面一段是systemd源码的注释,意思是:
- en代表以太网卡
- p3s0代表PCI接口的物理位置为(3, 0), 其中横座标代表bus,纵座标代表slot
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。