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中,可使用echo $PATH查看环境变量路径,用env命令

    2025年8月10日
    18200
  • xshell如何连接到linux

    Xshell连接Linux需输入目标IP、端口(默认22),选择SSH协议,输入

    2025年8月16日
    18000
  • Linux如何查看系统中所有已连接设备?

    在Linux系统中,设备管理是系统运维和开发中的基础操作,无论是排查硬件故障、识别外接设备,还是优化系统配置,都需要准确掌握设备信息的查看方法,Linux提供了丰富的命令行工具,支持从不同维度(如块设备、PCI设备、USB设备、CPU、内存等)查看系统中的所有设备信息,本文将详细介绍常用命令的功能、用法及输出解……

    2025年10月1日
    15300
  • Linux系统退出GDB调试器的正确方法是什么?

    在Linux系统中,GDB(GNU Debugger)是常用的程序调试工具,掌握退出GDB的方法是高效调试的基础,退出GDB的方式多样,可根据调试场景、程序状态及需求选择合适的方法,既能正常结束调试,也能应对异常卡顿或强制终止的情况,以下从常规退出、异常处理、脚本/批量退出等场景详细说明退出GDB的操作方法,常……

    2025年9月30日
    16700
  • linux下如何安装stax

    在Linux系统中安装stax(假设stax是一个用于特定任务处理的工具或框架,具体功能需结合实际场景,此处以通用安装流程为例)需要根据系统环境选择合适的方式,主要包括通过包管理器安装、源码编译安装两种主流方法,以下是详细步骤说明,安装前环境准备在开始安装前,需确保系统满足基本要求:建议Linux内核版本3.1……

    2025年10月8日
    18400

发表回复

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

联系我们

400-880-8834

在线咨询: QQ交谈

邮件:HI@E.KD.CN

关注微信