查看网卡设备信息,查看网卡生产商,型号
lspci | grep -i net
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
这里只有有线网卡,品牌是Realtek (厂商name),型号是RTL8111/8168/8411(设备name) 。一般ubuntu会自动安装网卡,若没有可以去ubuntu.iso上解压驱动后卸载重装或者品牌官网下载对应型号(设备id)的网卡驱动(无线网卡操作和这个类似)。如果失败可以更新下PCI ID列表的新版本 sudo update-pciids ,如果更新不了,可以从The PCI ID Repository下载,覆盖原来的/usr/share/misc/pci.ids文件(记得备份),点击“软件和更新”点击“附加驱动”,这时候系统会自动联网监测本机适用的附加驱动
可以通过查看pci.ids文件,找到device,然后下载
vendor(厂商id) vendor_name(厂商name)
device(设备id) device_name(设备name)
subvendor subdevice subsystem_name
lspci -v先查看该网卡对应驱动的版本号,该命令会列出所有pci的设备,网卡信息通常在最下面,此时还是r8169
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
Subsystem: Micro-Star International Co., Ltd. [MSI] RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
Flags: bus master, fast devsel, latency 0, IRQ 19
I/O ports at 3000 [size=256]
Memory at a2204000 (64-bit, non-prefetchable) [size=4K]
Memory at a2200000 (64-bit, non-prefetchable) [size=16K]
Capabilities: <access denied>
Kernel driver in use: r8169
Kernel modules: r8169
常见网络命令和设置
显示或设置网络设备命令:ifconfig
lo代表127.0.0.1,即localhost
ethernet(一般简称en),通常有线网卡为eth0,无线网卡则为wlan0
网卡禁用命令(eth0表示查询出来的网卡名称):
ifconfig eth0 down
网卡启用命令:
ifconfig eth0 up
用于查看无线连接情况:iwconfig
可以看到无线网卡,及其软硬开关状态:rfkill list
关闭编号0的设备
rfkill block 0
打开编号0的设备
rfkill unblock 0
查看设备信息:lsusb