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用户如何获取系统root权限的详细操作方法?

    在Linux系统中,root权限是最高权限,拥有对系统的完全控制能力,包括系统文件修改、用户管理、服务配置等操作,普通用户通常需要通过特定方式获取root权限,以确保系统安全并遵循最小权限原则,本文将详细介绍Linux系统中获取root权限的多种方法、配置技巧及安全注意事项,Linux权限体系与root用户概述……

    2025年9月21日
    8600
  • 大白菜工具如何安装Linux系统?

    使用大白菜装机工具安装Linux系统,通常需要借助其PE环境制作启动盘,再通过启动盘引导Linux安装程序,以下是详细操作步骤及注意事项:准备工作下载Linux镜像:从Linux发行版官网(如Ubuntu、Deepin、Fedora等)下载ISO镜像文件,建议选择稳定版(如Ubuntu 22.04 LTS),确……

    2025年9月17日
    29100
  • 如何在linux中安装vnc

    Linux中安装VNC,可使用包管理器如apt或yum,安装

    2025年8月19日
    9000
  • Linux系统如何启用Telnet服务及配置步骤?

    在Linux系统中,Telnet是一种基于TCP/IP的协议,用于远程登录和管理设备,通过命令行界面实现交互式操作,尽管因其明文传输特性存在安全隐患,但在内网调试、兼容旧设备等场景中仍有应用,本文将详细说明Linux系统启用Telnet服务的完整流程,涵盖安装、配置、防火墙设置及测试方法,帮助用户快速搭建环境……

    2025年9月16日
    7400
  • 如何快速查看已装Boost包?

    在Linux系统中卸载Boost库需要根据其安装方式选择对应方法,Boost通常通过包管理器安装或源码编译安装,以下是详细卸载步骤及注意事项:通过包管理器卸载(推荐方式)若Boost通过系统包管理器(如APT、YUM/DNF、Zypper)安装,使用对应命令卸载:Debian/Ubuntu(APT)# 卸载所有……

    2025年7月5日
    11000

发表回复

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

联系我们

400-880-8834

在线咨询: QQ交谈

邮件:HI@E.KD.CN

关注微信