linux如何查看物理网卡

Linux中,可使用ip link showifconfig -a命令查看物理

Linux系统中,查看物理网卡的信息可以通过多种方法进行,以下是一些常用的方法和命令,帮助你详细查看和管理物理网卡的信息。

使用 ip 命令

ip 命令是现代Linux系统中推荐使用的网络管理工具,它可以显示网络接口的详细信息。

ip link show

输出示例:

序号 接口名称 状态 MTU 队列 IFACE
1 lo UNKNOWN 65536 0 loopback
2 eth0 UP 1500 0 ether 00:1a:2b:3c:4d:5e
3 wlan0 DOWN 1500 0 ether 00:1a:2b:3c:4d:5f

在这个例子中,eth0wlan0 是物理网卡接口,lo 是本地回环接口。

使用 ifconfig 命令

ifconfig 是一个传统的网络配置命令,虽然在一些新版本的Linux发行版中已经被标记为过时,但仍然可以使用。

ifconfig -a

输出示例:

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 1000  (Local Loopback)
        RX packets 8  bytes 728 (728.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 728 (728.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.100  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::21a:2bff:fe3c:4d5e  prefixlen 64  scopeid 0x20<link>
        ether 00:1a:2b:3c:4d:5e  txqueuelen 1000  (Ethernet)
        RX packets 123456  bytes 12345678 (12.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 123456  bytes 12345678 (12.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

在这个例子中,eth0 是物理网卡接口,lo 是本地回环接口。

使用 lspci 命令

lspci 命令可以列出所有PCI设备,包括网卡,通过过滤网络控制器,可以找到物理网卡。

lspci | grep -i ethernet

输出示例:

02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 10)

在这个例子中,02:00.0 是网卡的PCI地址,Ethernet controller 表示这是一个以太网控制器。

使用 dmesg 命令

dmesg 命令可以查看系统启动时的日志信息,其中包含了硬件设备的检测信息。

dmesg | grep -i eth

输出示例:

[    0.123456] e1000: eth0: Intel(R) PRO/1000 Network Driver version 7.3.21-k8-NAPI
[    0.123456] e1000: eth0 NIC Link is Up [1] Gb/s

在这个例子中,eth0 是物理网卡接口,e1000 是网卡驱动。

使用 ethtool 命令

ethtool 命令可以查看和设置网络接口的参数,它需要安装 ethtool 包。

sudo apt-get install ethtool
ethtool eth0

输出示例:

Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                            100baseT/Half 100baseT/Full
                            1000baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                            100baseT/Half 100baseT/Full
                            1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: Unknown

在这个例子中,eth0 是物理网卡接口,ethtool 显示了网卡的详细参数。

使用 mii-tool 命令

mii-tool 命令可以查看网卡的MII(媒体独立接口)状态,它需要安装 mii-tool 包。

sudo apt-get install mii-tool
sudo mii-tool eth0

输出示例:

eth0: negotiated 100baseTx-FD, link ok

在这个例子中,eth0 是物理网卡接口,mii-tool 显示了网卡的链路状态。

使用 ifupdown 命令

ifupdown 命令可以查看网络接口的配置信息,它通常用于管理网络接口的启动和停止。

ifup eth0
ifdown eth0

使用 nmcli 命令

nmcli 是NetworkManager的命令行工具,可以查看和管理网络接口。

nmcli device status

输出示例:

DEVICE  TYPE      STATE      CONNECTION         
eth0    ethernet  connected  Wired connection 1 
wlan0   wifi      disconnected -              

在这个例子中,eth0 是物理网卡接口,wlan0 是无线网卡接口。

使用 lsblk 命令

lsblk 命令可以列出所有块设备,包括网卡相关的设备,虽然它主要用于查看存储设备,但也可以间接查看网卡信息。

lsblk -o NAME,TYPE,MODEL,SERIAL

输出示例:

NAME    TYPE   MODEL           SERIAL
sda     disk   ST1000DM003-1ER HDS5CZG3A
sdb     disk   ST2000DM004-1FK HDS6CZG4A

在这个例子中,虽然主要是存储设备,但也可以查看与网卡相关的设备信息。

使用 lshw 命令

lshw 命令可以列出系统的硬件信息,包括网卡。

sudo lshw -class network

输出示例:

*-network               
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: eth0
       version: 10
       serial: 00:1a:2b:3c:4d:5e
       size: 1GB/s
       capacity: 1GB/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vpd bus_master cap_list rom epa ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation ntuple offload stateless-reset wake-on-lan port-selection
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl_nic/rtl8168d-2\_0\.asf latency=0 link=yes multicast=yes port=twisted pair speed=100MB/s wake-on-lan=phyxaddr=00:1a:2b:3c:4d:5e xdma=unsupported xdma64=unsupported
       resources: irq:44 memory:f7d00000-f7d0ffff ioport:d000(size=256) memory:f7900000-f79fffff memory:f2000000-f20fffff memory:f7a00000-f7a0ffff memory:f7b00000-f7bfffff memory:f7c00000-f7cfffff memory:f7d8c000-f7d8ffff memory:f7dd8000-f7ddffff memory:f7df4000-f7dfffff memory:f7dfa8c8-f7dfabcf memory:f7dfac00-f7dfafff memory:f7dfb000-f7dfbfff memory:f7dfc8c8-f7dfcb3f memory:f7dfcc00-f7dfcfff memory:f7dfd8c8-f7dfdb3f memory:f7dfdc00-f7dfdfff memory:f7dfe8c8-f7dfeb3f memory:f7dfec00-f7dfefff memory:f7df3c8c8-f7df3cb3f memory:f7df3c4c8-f7df3c4ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:f7df3c8c8-f7df3c8ff memory:

各位小伙伴们,我刚刚为大家分享了有关linux如何查看物理网卡的知识,希望对你们有所帮助。如果您还有其他相关问题需要解决,欢迎随时提出哦!

原创文章,发布者:酷番叔,转转请注明出处:https://cloud.kd.cn/ask/10484.html

(0)
酷番叔酷番叔
上一篇 2025年8月13日 16:59
下一篇 2025年8月13日 17:04

相关推荐

  • Linux如何配置服务实现开机自启动?

    Linux系统作为服务器和应用部署的主流平台,许多关键服务(如数据库、Web服务器、监控工具等)需要在系统启动后自动运行,以确保服务的持续可用性,开机自启动服务的配置是Linux系统管理中的基础技能,不同版本的Linux系统可能采用不同的初始化系统(如Systemd、SysVinit、Upstart等),导致配……

    2025年9月16日
    2300
  • Linux下MySQL数据库文件如何备份?

    在Linux环境下对MySQL数据库进行备份是保障数据安全的重要操作,常见的备份方法包括使用mysqldump工具、直接复制数据文件、mysqlhotcopy以及Percona XtraBackup等,每种方法适用于不同场景,需根据数据库引擎、大小和业务需求选择,使用mysqldump工具备份mysqldump……

    2025年9月19日
    2800
  • Linux环境下如何详细编译Java程序?步骤与方法有哪些?

    在Linux环境下进行Java程序的编译是Java开发的基础技能,掌握这一过程有助于理解Java代码从源文件到可执行程序的转化原理,本文将详细介绍Linux环境下编译Java程序的完整流程,包括JDK安装、环境变量配置、代码编写、编译命令使用、构建工具应用等内容,帮助读者系统掌握Java编译的核心操作,JDK的……

    2025年8月28日
    3800
  • 如何从基础开始系统学习Linux脚本文件的编写步骤与方法?

    Linux脚本文件是Linux系统中用于自动化任务、批量处理数据和简化重复操作的重要工具,通过将一系列命令组合在一起,实现高效执行,编写Linux脚本需要掌握基本语法、命令使用和调试技巧,以下是详细步骤和注意事项,环境准备在编写脚本前,需确保系统已安装bash解释器(Linux默认自带),创建脚本文件时,通常以……

    2025年9月26日
    1500
  • 在Linux中,如何使用命令高效查找并替换文本内容?

    在Linux系统中,查找替换是日常运维和文本处理的核心操作,掌握相关工具和方法能大幅提升工作效率,本文将详细介绍Linux中常用的查找替换工具,包括单文件处理、批量文件处理、文件名替换等场景,并结合实例说明其使用方法,替换:sed命令sed(Stream Editor)是Linux中最强大的流编辑器,支持对文本……

    2025年10月6日
    1000

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

联系我们

400-880-8834

在线咨询: QQ交谈

邮件:HI@E.KD.CN

关注微信