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

一、查看网卡mac地址

#安装lshw

[root@server ~]# yum install lshw

#使用方法

[root@rsync-server ~]# lshw -c network
  *-network:0               
       description: Ethernet interface
       product: NetXtreme II BCM5709 Gigabit Ethernet
       vendor: Broadcom Limited
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: enp2s0f0
       version: 20
       serial: 00:26:55:31:a9:dc
       size: 1Gbit/s
       capacity: 1Gbit/s
        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: pci@0000:02:00.1
       logical name: enp2s0f1
       version: 20
       serial: 00:26:55:31:a9:de
       size: 1Gbit/s
       capacity: 1Gbit/s
        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: pci@0000:03:00.0
       logical name: enp3s0f0
       version: 20
       serial: 00:26:55:31:a9:e0
       size: 1Gbit/s
       capacity: 1Gbit/s
        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: pci@0000:03:00.1
       logical name: enp3s0f1
       version: 20
       serial: 00:26:55:31:a9:e2
       capacity: 1Gbit/s
        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

#使用方法

[root@server ~]# 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参数

[root@rsync-server ~]# 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]

  

原文地址:https://www.cnblogs.com/nulige/p/7804629.html