linux 下查看硬件信息(mac,IP地址,硬盘型号,序列号等)

Posted 努力哥-运维自动化

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux 下查看硬件信息(mac,IP地址,硬盘型号,序列号等)相关的知识,希望对你有一定的参考价值。

一、查看网卡mac地址

#安装lshw

[[email protected] ~]# yum install lshw

#使用方法

[[email protected] ~]# lshw -c network
  *-network:0               
       description: Ethernet interface
       product: NetXtreme II BCM5709 Gigabit Ethernet
       vendor: Broadcom Limited
       physical id: 0
       bus info: [email protected]:02:00.0
       logical name: enp2s0f0
       version: 20
       serial: 00:26:55:31:a9:dc
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm vpd msi msix pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=bnx2 driverversion=2.2.6 duplex=full firmware=bc 4.6.4 NCSI 1.0.3 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:16 memory:f4000000-f5ffffff
  *-network:1
       description: Ethernet interface
       product: NetXtreme II BCM5709 Gigabit Ethernet
       vendor: Broadcom Limited
       physical id: 0.1
       bus info: [email protected]:02:00.1
       logical name: enp2s0f1
       version: 20
       serial: 00:26:55:31:a9:de
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm vpd msi msix pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=bnx2 driverversion=2.2.6 duplex=full firmware=bc 4.6.4 NCSI 1.0.3 ip=10.0.100.85 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:17 memory:f2000000-f3ffffff
  *-network:0
       description: Ethernet interface
       product: NetXtreme II BCM5709 Gigabit Ethernet
       vendor: Broadcom Limited
       physical id: 0
       bus info: [email protected]:03:00.0
       logical name: enp3s0f0
       version: 20
       serial: 00:26:55:31:a9:e0
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm vpd msi msix pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=bnx2 driverversion=2.2.6 duplex=full firmware=bc 4.6.4 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:18 memory:f8000000-f9ffffff
  *-network:1
       description: Ethernet interface
       product: NetXtreme II BCM5709 Gigabit Ethernet
       vendor: Broadcom Limited
       physical id: 0.1
       bus info: [email protected]:03:00.1
       logical name: enp3s0f1
       version: 20
       serial: 00:26:55:31:a9:e2
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm vpd msi msix pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=bnx2 driverversion=2.2.6 firmware=bc 4.6.4 latency=0 link=no multicast=yes port=twisted pair
       resources: irq:19 memory:f6000000-f7ffffff

 

二、查看硬盘

#安装 smartmontools

yum install smartmontools -y

#使用方法

[[email protected] ~]# smartctl -a /dev/sda
smartctl 6.2 2017-02-27 r4394 [x86_64-linux-3.10.0-514.26.2.el7.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               HP
Product:              LOGICAL VOLUME
Revision:             2.74
User Capacity:        384,005,660,672 bytes [384 GB]
Logical block size:   512 bytes
Rotation Rate:        15000 rpm
Logical Unit id:      0x600508b1001030393636354543300b00
Serial number:        50123456789ABCDE
Device type:          disk
Local Time is:        Wed Nov  8 16:10:00 2017 CST
SMART support is:     Unavailable - device lacks SMART capability.

=== START OF READ SMART DATA SECTION ===

Error Counter logging not supported

Device does not support Self Test logging

#加-c参数

[[email protected] ~]# smartctl -x /dev/sda
smartctl 6.2 2017-02-27 r4394 [x86_64-linux-3.10.0-514.26.2.el7.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               HP
Product:              LOGICAL VOLUME
Revision:             2.74
User Capacity:        384,005,660,672 bytes [384 GB]
Logical block size:   512 bytes
Rotation Rate:        15000 rpm
Logical Unit id:      0x600508b1001030393636354543300b00
Serial number:        50123456789ABCDE
Device type:          disk
Local Time is:        Wed Nov  8 16:12:07 2017 CST
SMART support is:     Unavailable - device lacks SMART capability.
Read Cache is:        Enabled
Writeback Cache is:   Disabled

=== START OF READ SMART DATA SECTION ===

Error Counter logging not supported

Device does not support Self Test logging
Device does not support Background scan results logging
scsiPrintSasPhy Log Sense Failed [unsupported scsi opcode]

  

 

以上是关于linux 下查看硬件信息(mac,IP地址,硬盘型号,序列号等)的主要内容,如果未能解决你的问题,请参考以下文章

linux下查看cpu,内存,硬盘等硬件信息的方法

linux下查看cpu,内存,硬盘等硬件信息的方法

在linux里面怎么获取mac地址

linux下怎样获取网络设备的mac地址,ip地址等

linux查看硬件命令都有哪些

使用WMI编程获取主机硬件信息(CPU_ID,硬盘主板BIOS序列号,Mac地址)