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)
酷番叔酷番叔
上一篇 1天前
下一篇 1天前

相关推荐

  • linux如何查看工作组

    Linux 中,可通过命令 groups 用户名查看用户所属工作组,或用 `

    1天前
    500
  • Linux jobs异常占用资源怎么办?

    查看当前Jobs停止前需确认任务ID:jobs -l输出示例:[1] + 10234 Running ./long_script.sh &[2] – 10256 Stopped vim config.conf[1]:任务编号(Job ID)10234:进程ID(PID)Running/Stopped:任……

    2025年7月29日
    1200
  • 如何在 Linux 中设置软连接?

    软连接的核心作用跨文件系统链接:可链接不同磁盘分区或网络位置的文件/目录,灵活管理:源文件移动/重命名后,软连接自动失效(需重新创建),节省空间:仅存储目标路径信息(约几十字节),创建软连接的命令使用 ln 命令配合 -s 选项:ln -s [源文件/目录路径] [软连接路径]示例场景为文件创建软连接ln -s……

    2025年6月18日
    2700
  • 安装命令该选哪个发行版?

    安装命令因Linux发行版而异:Debian/Ubuntu使用apt install,Red Hat/CentOS用yum install或dnf install,Arch/Manjaro用pacman -S,openSUSE则用zypper install。

    2025年8月7日
    600
  • 命令行工具为何比图形界面快?

    在Linux系统中,快速定位文件位置是日常操作的关键技能,无论是系统管理员、开发者还是普通用户,掌握高效的查找方法都能大幅提升工作效率,以下是几种专业且实用的文件定位方法,结合命令行工具和图形界面操作,满足不同场景需求:find 命令(最强大的搜索工具)适用场景:按名称、类型、时间、大小等条件深度搜索,基础语法……

    2025年7月25日
    1700

发表回复

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

联系我们

400-880-8834

在线咨询: QQ交谈

邮件:HI@E.KD.CN

关注微信