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如何配置SMTP发邮件?

    SMTP服务核心方案方案1:配置本地SMTP服务器(以Postfix为例)安装Postfixsudo apt update && sudo apt install postfix # Debian/Ubuntusudo yum install postfix # CentOS/RHEL安装时选择……

    2025年6月13日
    7800
  • PHP文件上传安全漏洞如何防护?

    基础实现步骤前端表单设计<form action="upload.php" method="post" enctype="multipart/form-data"> <input type="file" name……

    2025年7月24日
    6400
  • Linux如何安装开发所需的header文件?

    Linux系统中,header文件(也称头文件)是内核开发的核心组件,包含了内核函数、数据结构、宏定义等关键信息,是编译内核模块、驱动程序或进行内核级编程的必备依赖,若缺少对应的header文件,用户可能无法成功编译第三方驱动、自定义内核模块,甚至会影响部分依赖内核功能的软件正常运行,本文将详细介绍主流Linu……

    2025年9月9日
    4200
  • Linux分区如何合理?分区原则、方法与技巧有哪些?

    Linux分区是系统安装和运维中的关键环节,合理的分区不仅能提升系统性能,还能增强数据安全性和管理效率,分区时需结合使用场景(如服务器、桌面环境、虚拟机等)、硬件配置(磁盘大小、内存容量)及安全需求综合规划,以下是具体建议,核心分区类型及规划原则Linux系统分区需遵循“功能分离、独立管理”原则,将不同用途的数……

    2025年9月22日
    4100
  • Linux如何登录到系统界面?

    Linux系统登录界面是用户与系统交互的第一步,根据使用场景和配置不同,登录方式可分为命令行界面(CLI)登录和图形用户界面(GUI)登录,同时还包括远程登录(如SSH)和特殊模式登录(如单用户模式),以下从不同场景详细说明Linux登录界面的操作流程及相关注意事项,命令行界面(CLI)登录CLI是Linux系……

    2025年9月20日
    4300

发表回复

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

联系我们

400-880-8834

在线咨询: QQ交谈

邮件:HI@E.KD.CN

关注微信