Odczyt informacji o sprzęcie w FreeBSD
FreeBSD udostępnia kilka poleceń, które umożliwiają wyświetlenie "'informacji o używanym sprzęcie'". W tym artykule przedstawiamy niektóre z tych poleceń. O ile nie wskazano inaczej, to zastosowany został serwer 1U Intel single CPU RI1102D-F z wersją OPNsense 18.7.
camcontrol
Narzędzie camcontrol pozwala na zarządzanie podsystemem CAM w FreeBSD. CAM oznacza Common Access Method. Jest to ogólny sposób adresowania podobnych do SCSI magistrali I/O. Za pomocą parametru 'devlist' jest wyświetlany wykaz istniejących Urządzeń.
# camcontrol devlist
Wynik polecenia (w tym przykładzie zastosowaliśmy system LES network+) wygląda następująco:
<SanDisk SD8SFAT064G1122 Z2333000> at scbus0 target 0 lun 0 (pass0,ada0)
clog /var/log/system.log
Plik system.log zawiera wiele informacji, które są zapisywane przez jądro FreeBSD i inne komponenty oprogramowania podczas i po uruchomieniu.
# clog /var/log/system.log
Na wyjściu jest widoczne:
Jul 10 12:56:37 OPNsense syslogd: kernel boot file is /boot/kernel/kernel Jul 10 12:56:37 OPNsense kernel: Copyright (c) 1992-2017 The FreeBSD Project. Jul 10 12:56:37 OPNsense kernel: Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 Jul 10 12:56:37 OPNsense kernel: The Regents of the University of California. All rights reserved. Jul 10 12:56:37 OPNsense kernel: FreeBSD is a registered trademark of The FreeBSD Foundation. Jul 10 12:56:37 OPNsense kernel: FreeBSD 11.1-RELEASE-p9 e86703e30(stable/18.1) amd64 Jul 10 12:56:37 OPNsense kernel: FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM 4.0.0) Jul 10 12:56:37 OPNsense kernel: VT(efifb): resolution 800x600 Jul 10 12:56:37 OPNsense kernel: [HBSD LOG] logging to system: enabled Jul 10 12:56:37 OPNsense kernel: [HBSD LOG] logging to user: disabled Jul 10 12:56:37 OPNsense kernel: [HBSD HARDENING] procfs hardening: enabled Jul 10 12:56:37 OPNsense kernel: [HBSD ASLR] status: opt-out Jul 10 12:56:37 OPNsense kernel: [HBSD ASLR] mmap: 30 bit [...] Jul 10 12:56:37 OPNsense kernel: [HBSD SEGVGUARD] status: opt-out Jul 10 12:56:37 OPNsense kernel: [HBSD SEGVGUARD] expiry: 120 sec Jul 10 12:56:37 OPNsense kernel: [HBSD SEGVGUARD] suspension: 600 sec Jul 10 12:56:37 OPNsense kernel: [HBSD SEGVGUARD] maxcrashes: 5 Jul 10 12:56:37 OPNsense kernel: CPU: Intel(R) Xeon(R) CPU D-1518 @ 2.20GHz (2200.05-MHz K8-class CPU) Jul 10 12:56:37 OPNsense kernel: Origin="GenuineIntel" Id=0x50663 Family=0x6 Model=0x56 Stepping=3 Jul 10 12:56:37 OPNsense kernel: Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> Jul 10 12:56:37 OPNsense kernel: Features2=0x7ffefbff<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND> Jul 10 12:56:37 OPNsense kernel: AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM> Jul 10 12:56:37 OPNsense kernel: AMD Features2=0x121<LAHF,ABM,Prefetch> Jul 10 12:56:37 OPNsense kernel: Structured Extended Features=0x21cbfbb<FSGSBASE,TSCADJ,BMI1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,PQM,NFPUSG,PQE,RDSEED,ADX,SMAP,PROCTRACE> Jul 10 12:56:37 OPNsense kernel: Structured Extended Features3=0xc000000<IBPB,STIBP> Jul 10 12:56:37 OPNsense kernel: XSAVE Features=0x1<XSAVEOPT> [...]
devinfo
# devinfo -rv
Na wyjściu jest widoczne:
nexus0 cryptosoft0 apic0 ram0 I/O memory addresses: 0x0-0x9bfff 0x100000-0x795d0fff 0x797a2000-0x7989afff 0x7bdb1000-0x7bdb1fff 0x7be38000-0x7bffffff 0x100000000-0x17fffffff acpi0 [...] cpu0 pnpinfo _HID=ACPI0007 _UID=0 at handle=\_SB_.SCK0.CP00 _PXM=0 acpi_throttle0 est0 p4tcc0 acpi_perf0 cpufreq0 [...] pci5 pcib5 bus numbers: 4 ix0 pnpinfo vendor=0x8086 device=0x15ac subvendor=0x15d9 subdevice=0x15ac class=0x020000 at slot=0 function=0 dbsf=pci0:4:0:0 handle=\_SB_.PCI0.BR2C.H000 Interrupt request lines: 0x111 0x112 0x113 0x114 0x115 0x116 0x117 0x118 0x119 pcib5 prefetch window: 0xfbc00000-0xfbdfffff 0xfbe04000-0xfbe07fff [...] aesni0
dmesg
Narzędzie dmesg wyświetla zawartość bufora komunikatów systemowych (system message buffer).
# dmesg
Na wyjściu jest widoczne:
Copyright (c) 1992-2017 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 11.1-RELEASE-p11 21b4c8ea1d5(stable/18.7) amd64 [...] real memory = 4294967296 (4096 MB) avail memory = 3955470336 (3772 MB) Event timer "LAPIC" quality 600 ACPI APIC Table: <SUPERM SMCI--MB> FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs FreeBSD/SMP: 1 package(s) x 4 core(s) x 2 hardware threads [...] ix0: <Intel(R) PRO/10GbE PCI-Express Network Driver, Version - 3.2.12-k> mem 0xfbc00000-0xfbdfffff,0xfbe04000-0xfbe07fff [...] igb0: <Intel(R) PRO/1000 Network Connection, Version - 2.5.3-k> port 0xe000-0xe01f mem [...] nvd0: <INTEL SSDPEKKW128G8> NVMe namespace nvd0: 122104MB (250069680 512 byte sectors) [...] aesni0: <AES-CBC,AES-XTS,AES-GCM,AES-ICM> on motherboard [...]
dmidecode
Narzędzie dmidecode wyświetla zawartość tabel DMI (Desktop Management Interface):
# dmidecode
W FreeBSD i OPNsense dmidecode musi zazwyczaj zostać doinstalowane:
# pkg install dmidecode
Na wyjściu jest widoczne:
root@fw-neufelden:~ # dmidecode # dmidecode 3.2 # SMBIOS entry point at 0x8d346000 Found SMBIOS entry point in EFI, reading table from /dev/mem. SMBIOS 3.0 present. 68 structures occupying 3320 bytes. Table at 0x8D343000. Handle 0x0000, DMI type 0, 24 bytes BIOS Information Vendor: American Megatrends Inc. Version: 5.12 Release Date: 05/24/2019 Address: 0xF0000 Runtime Size: 64 kB ROM Size: 16 MB Characteristics: PCI is supported BIOS is upgradeable BIOS shadowing is allowed Boot from CD is supported [...]
freebsd-version
Polecenie freebsd-version wyświetla wersję i poziom poprawek zainstalowanego systemu. Opcja '-k' pokazuje wersję jądra.
# freebsd-version -k
Na wyjściu jest widoczne:
11.1-RELEASE-p11
Opcja '-u' pokazuje wersję Userland.
# freebsd-version -u
Na wyjściu jest widoczne:
11.1-RELEASE-p11
gpart
Komendy geom (skrót dla geomtri dysku w FreeBSD) kontrolują różne klasy GEOM w FreeBSD.
Aktualne informacje o partycjach mogą zostać wyświetlone następującą komendą:
# gpart show
Wynik polecenia (w tym przykładzie zastosowaliśmy system LES network+) wygląda następująco:
=> 40 125045344 ada0 GPT (60G) 40 409600 1 efi (200M) 409640 1024 2 freebsd-boot (512K) 410664 106171048 3 freebsd-ufs (51G) 106581712 16777216 4 freebsd-swap (8.0G) 123358928 1686456 - free - (823M)
Szczegółowe informacje o partycjach mogą zostać wyświetlone następującą komendą:
# gpart list
Wynik polecenia w tym przykładzie zastosowaliśmy system LES network+) wygląda następująco:
Geom name: ada0 modified: false state: OK fwheads: 16 fwsectors: 63 last: 125045383 first: 40 entries: 152 scheme: GPT Providers: 1. Name: ada0p1 Mediasize: 209715200 (200M) Sectorsize: 512 Stripesize: 0 Stripeoffset: 20480 Mode: r0w0e0 rawuuid: ae6015a9-6f0d-11e8-a8f7-0030180173f6 rawtype: c12a7328-f81f-11d2-ba4b-00a0c93ec93b label: (null) length: 209715200 offset: 20480 type: efi index: 1 end: 409639 start: 40 [...] Consumers: 1. Name: ada0 Mediasize: 64023257088 (60G) Sectorsize: 512 Mode: r2w2e5
ifconfig
# ifconfig
Na wyjściu jest widoczne:
ix0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=e407bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6> ether ac:1f:6b:64:aa:2e hwaddr ac:1f:6b:64:aa:2e inet 172.16.10.2 netmask 0xffffff00 broadcast 172.16.10.255 inet6 fe80::ae1f:6bff:fe64:aa2e%ix0 prefixlen 64 scopeid 0x1 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> media: Ethernet autoselect status: no carrier [...] igb0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=6407bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6> ether ac:1f:6b:64:a5:e6 hwaddr ac:1f:6b:64:a5:e6 inet 172.16.1.2 netmask 0xffffff00 broadcast 172.16.1.255 inet6 fe80::ae1f:6bff:fe64:a5e6%igb0 prefixlen 64 scopeid 0x3 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> media: Ethernet autoselect status: no carrier [...]
kldstat
# kldstat
Na wyjściu jest widoczne:
Id Refs Address Size Name 1 92 0xffffffff80200000 21484c0 kernel 2 1 0xffffffff8234a000 6e18 if_gre.ko 3 1 0xffffffff82351000 7570 if_tap.ko [...] 45 1 0xffffffff827e9000 7130 aesni.ko
pciconf
# pciconf -lv
Na wyjściu jest widoczne:
[...] ix0@pci0:4:0:0: class=0x020000 card=0x15ac15d9 chip=0x15ac8086 rev=0x00 hdr=0x00 vendor = 'Intel Corporation' device = 'Ethernet Connection X552 10 GbE SFP+' class = network subclass = ethernet [...] igb0@pci0:7:0:0: class=0x020000 card=0x153315d9 chip=0x15338086 rev=0x03 hdr=0x00 vendor = 'Intel Corporation' device = 'I210 Gigabit Network Connection' class = network subclass = ethernet [...] igb2@pci0:11:0:0: class=0x020000 card=0x152115d9 chip=0x15218086 rev=0x01 hdr=0x00 vendor = 'Intel Corporation' device = 'I350 Gigabit Network Connection' class = network subclass = ethernet [...]
pkg info
# pkg info
Na wyjściu jest widoczne:
GeoIP-1.6.12 Find the country that any IP address or hostname originates from apinger-0.7 IP device monitoring tool [...] cpustats-0.1 Gather system statistics [...] ntp-4.2.8p11_2 The Network Time Protocol Distribution openldap-sasl-client-2.4.46 Open source LDAP client implementation with SASL2 support openssh-portable-7.7.p1_6,1 The portable version of OpenBSD's OpenSSH openssl-1.0.2o_4,1 SSL and crypto library openvpn-2.4.6_1 Secure IP/Ethernet tunnel daemon opnsense-18.7 OPNsense release package opnsense-lang-18.1.7 OPNsense translations opnsense-update-18.7 OPNsense update utilities [...] suricata-4.0.5 High Performance Network IDS, IPS and Security Monitoring engine syslogd-11.1 FreeBSD syslogd with additions unbound-1.7.3 Validating, recursive, and caching DNS resolver wpa_supplicant-2.6_2 Supplicant (client) for WPA/802.1x protocols zip-3.0_1 Create/update ZIP files compatible with PKZIP
# pkg info opnsense
Na wyjściu jest widoczne:
opnsense-18.7 Name : opnsense Version : 18.7 Installed on : Tue Aug 7 13:51:34 2018 CEST Origin : opnsense/opnsense Architecture : FreeBSD:11:amd64 Prefix : /usr/local Categories : sysutils www Licenses : BSD2CLAUSE Maintainer : franco@opnsense.org WWW : https://opnsense.org/ Comment : OPNsense release package Annotations : FreeBSD_version: 1101001 repo_type : binary repository : OPNsense Flat size : 25.1MiB Description : 950d04f47
sysctl
# sysctl -a
Na wyjściu jest widoczne:
kern.ostype: FreeBSD kern.osrelease: 11.1-RELEASE-p11 kern.osrevision: 199506 kern.version: FreeBSD 11.1-RELEASE-p11 21b4c8ea1d5(stable/18.7) [...] hw.igb.tx_process_limit: -1 hw.igb.rx_process_limit: 100 hw.igb.num_queues: 0 hw.igb.header_split: 0 hw.igb.buf_ring_size: 4096 hw.igb.max_interrupt_rate: 8000 hw.igb.enable_msix: 1 hw.igb.enable_aim: 1 hw.igb.txd: 1024 hw.igb.rxd: 1024 [...] dev.igb.0.host.header_redir_missed: 0 dev.igb.0.host.serdes_violation_pkt: 0 dev.igb.0.dropped: 0 dev.igb.0.eee_disabled: 0 dev.igb.0.dmac: 0 dev.igb.0.tx_processing_limit: -1 dev.igb.0.rx_processing_limit: 100 dev.igb.0.fc: 3 dev.igb.0.enable_aim: 1 dev.igb.0.nvm: -1 dev.igb.0.%parent: pci8 dev.igb.0.%pnpinfo: vendor=0x8086 device=0x1533 subvendor=0x15d9 subdevice=0x1533 class=0x020000 dev.igb.0.%location: slot=0 function=0 dbsf=pci0:7:0:0 handle=\_SB_.PCI0.RP01.D02D dev.igb.0.%driver: igb dev.igb.0.%desc: Intel(R) PRO/1000 Network Connection, Version - 2.5.3-k dev.igb.%parent: [...]
W połączeniu z 'grep' mogą zostać wyświetlone informacje, takie jak wersje sterowników:[1]
root@OPNsense-18-7:~/hw-analyse-frontio-mit-x710 # sysctl -a | grep -E 'dev.(igb|ix|em).*.%desc:' dev.igb.5.%desc: Intel(R) PRO/1000 Network Connection, Version - 2.5.3-k dev.igb.4.%desc: Intel(R) PRO/1000 Network Connection, Version - 2.5.3-k dev.igb.3.%desc: Intel(R) PRO/1000 Network Connection, Version - 2.5.3-k dev.igb.2.%desc: Intel(R) PRO/1000 Network Connection, Version - 2.5.3-k dev.igb.1.%desc: Intel(R) PRO/1000 Network Connection, Version - 2.5.3-k dev.igb.0.%desc: Intel(R) PRO/1000 Network Connection, Version - 2.5.3-k dev.ixl.1.%desc: Intel(R) Ethernet Connection 700 Series PF Driver, Version - 1.9.9-k dev.ixl.0.%desc: Intel(R) Ethernet Connection 700 Series PF Driver, Version - 1.9.9-k dev.ix.1.%desc: Intel(R) PRO/10GbE PCI-Express Network Driver, Version - 3.2.12-k dev.ix.0.%desc: Intel(R) PRO/10GbE PCI-Express Network Driver, Version - 3.2.12-k root@OPNsense-18-7:~/hw-analyse-frontio-mit-x710 # sysctl dev.ixl.0.fw_version dev.ixl.0.fw_version: fw 6.0.48442 api 1.7 nvm 6.01 etid 800035cf oem 1.262.0
x86info
Narzędzie x86info pozwala na odczytanie wielu informacji o zastosowanym procesorze, np. również wersję mikrokodu procesorów firmy Intel.
Uwaga: program x86info nie jest zawarty w OPNsense (który jest oparty na FreeBSD). Aby zainstalować go poprzez pkg install x86info, pakiety FreeBSD muszą być najpierw tymczasowo dopuszczone do instalacji (należy w /usr/local/etc/pkg/repos/FreeBSD.conf podać wartość yes). Po instalacji należy ponownie wprowadzić wartość " no".
Instalacja x86info w OPNsense:
root@OPNsense:~ # vi /usr/local/etc/pkg/repos/FreeBSD.conf root@OPNsense:~ # cat /usr/local/etc/pkg/repos/FreeBSD.conf FreeBSD: { enabled: yes } root@OPNsense:~ # pkg install x86info [...] The following 3 package(s) will be affected (of 0 checked): New packages to be INSTALLED: x86info: 1.31.s02 [FreeBSD] libpci: 3.6.2 [OPNsense] pciids: 20180428 [FreeBSD] [...] root@OPNsense:~ # vi /usr/local/etc/pkg/repos/FreeBSD.conf root@OPNsense:~ # cat /usr/local/etc/pkg/repos/FreeBSD.conf FreeBSD: { enabled: no } root@OPNsense:~ #
Aby uruchomić narzędzie, należy najpierw załadować moduł cpuctl za pomocą kldload. Poniższy przykład pokazuje wyjście x86info na systemie LES network+.
root@OPNsense:~ # kldload cpuctl root@OPNsense:~ # x86info -a x86info v1.31pre MP Table: # APIC ID Version State Family Model Step Flags # 0 0x15 BSP, usable 6 14 3 0x0381 # 2 0x15 AP, usable 6 14 3 0x0381 Found 4 identical CPUs Extended Family: 0 Extended Model: 4 Family: 6 Model: 78 Stepping: 3 Type: 0 (Original OEM) CPU Model (x86info's best guess): Core i7 [Skylake Mobile] Processor name string (BIOS programmed): Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz Performance msrs: MSR_IA32_PERF_STATUS: 0x1c2a00001700 MSR_IA32_MISC_ENABLE: 0x850089 [Enabled: TCC PerfMon EnhancedSpeedStep ] Thermal msrs: MSR_PM_THERM2_CTL: 0x0 [Thermal monitor: 1] MSR_IA32_THERM_CONTROL: 0x0 [Software-controlled clock disabled (full speed)] MSR_IA32_THERM_STATUS: 0x88390000 Machine check MSRs: Number of reporting banks : 8 Bank: 0 (0x400) MC0CTL: 00000000 00000000 00000000 00000000 00000000 00000000 00001111 11111111 MC0STATUS: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 MC0ADDR: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [...] Bank: 7 (0x41c) MC7CTL: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 11111111 MC7STATUS: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 MC7ADDR: 00000000 00000000 00000000 00000000 11111110 11110001 11011001 01000000 Microcode version: 0x00000000000000c2 eax in: 0x00000000, eax = 00000016 ebx = 756e6547 ecx = 6c65746e edx = 49656e69 eax in: 0x00000001, eax = 000406e3 ebx = 00100800 ecx = 7ffafbff edx = bfebfbff [...] eax in: 0x80000008, eax = 00003027 ebx = 00000000 ecx = 00000000 edx = 00000000 Cache info L1 Data Cache: 32KB, 8-way associative, 64 byte line size L1 Instruction Cache: 32KB, 8-way associative, 64 byte line size L2 Unified Cache: 256KB, 4-way associative, 64 byte line size L3 Unified Cache: 3072KB, 12-way associative, 64 byte line size TLB info Instruction TLB: 2M/4M pages, fully associative, 8 entries Instruction TLB: 4K pages, 8-way associative, 64 entries Data TLB: 1GB pages, 4-way set associative, 4 entries Data TLB: 4KB pages, 4-way associative, 64 entries Shared L2 TLB: 4KB/2MB pages, 6-way associative, 1536 entries 64 byte prefetching. Feature flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflsh ds acpi mmx fxsr sse sse2 ss ht tm pbe sse3 pclmuldq dtes64 monitor ds-cpl vmx smx est tm2 ssse3 sdbg fma cx16 xTPR pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc-deadline aes xsave osxsave avx f16c rdrnd Extended feature flags: SYSCALL xd pdpe1gb rdtscp em64t lahf_lm lzcnt prefetchw dts ida arat pln ecmd ptm hwp hwp_notify hwp_act_window hwp_epp hdc fsgsbase tsc_adj sgx bmi1 hle avx2 smep bmi2 erms invpcid rtm nofpucs mpx rdseed adx smap clflushopt ipt nonstop_tsc Long NOPs supported: yes MTRR registers: MTRRcap (0xfe): 0x0000000000001d0a wc:1 fix:1 vcnt:10 [...] MTRRdefType (0x2ff): 0x0000000000000c06 (fixed-range flag:1 enable flag:1 default type:0x06 (write-back)) APIC registers: APIC MSR Base(0x1b): : 0x00000000fee00900 [...] APIC Divide Configuration (for Timer) : 0x00000000 Address sizes : 39 bits physical, 48 bits virtual 2.50GHz processor (estimate). Total processor threads: 4 This system has 1 dual-core processor with hyper-threading (2 threads per core) running at an estimated 2.50GHz
Odnośniki
- ↑ Query Intel NIC driver version (forum.opnsense.org, 10.08.2018)
Autor: Werner Fischer