IBM Cloud: Power Systems Virtual Server(AIX)でよく利用するコマンド


#良く使うsmitコマンド

```shell-session
ファイルシステム変更
#smitty jfs2

ネットワーク変更
#smitty tcpip
```


# IPアドレス

```shell-session:インターフェースに割り当てられているIPアドレス情報を取得
# ifconfig -a
```

```shell-session:IPアドレスを再度割り当て
# ifconfig en0 down detach
# rmdev -dl en0
# cfgmgr
# /usr/sbin/mktcpip -h <HOSTNAME: power1> -a <IPアドレス: 192.168.130.90> -m <netmask: 255.255.255.248> -i en0 -t N/A -g <Default Gateway: 192.168.130.89> 
```

# 経路情報

```shell-session:IPv4とIPv6の経路情報を出力
# netstat -rn
```
```shell-session:IPv4のみの経路情報を出力
# netstat -rn -f inet
```

# システム情報

```shell-session:OSバージョン
# oslevel -s
7200-03-03-1913
```
```shell-session:プロセッサー情報
# lsattr -El proc0
frequency   2500000000     Processor Speed       False
smt_enabled true           Processor SMT enabled False
smt_threads 8              Processor SMT threads False
state       enable         Processor state       False
type        PowerPC_POWER9 Processor type        False
```

```shell-session:メモリ情報
# lsattr -El mem0
ent_mem_cap         I/O memory entitlement in Kbytes           False
goodsize       2048 Amount of usable physical memory in Mbytes False
mem_exp_factor      Memory expansion factor                    False
size           2048 Total amount of physical memory in Mbytes  False
var_mem_weight      Variable memory capacity weight            False

# lsconf -m
Memory Size: 2048 MB
```

```shell-session:システム情報全部
# lsconf
System Model: IBM,9009-22A
Machine Serial Number: 7838470
Processor Type: PowerPC_POWER9
Processor Implementation Mode: POWER 9
Processor Version: PV_9_Compat
Number Of Processors: 1
Processor Clock Speed: 2500 MHz
CPU Type: 64-bit
Kernel Type: 64-bit
LPAR Info: 6 power1-e3bb2eed-00000151
Memory Size: 2048 MB
Good Memory Size: 2048 MB
Platform Firmware level: VL940_041
Firmware Version: IBM,FW940.02 (VL940_041)
Console Login: enable
Auto Restart: true
Full Core: false
NX Crypto Acceleration: Capable and Enabled

Network Information
        Host Name: power1
        IP Address: 192.168.130.90
        Sub Netmask: 255.255.255.248
        Gateway: 192.168.130.89
        Name Server:
        Domain Name:

Paging Space Information
        Total Paging Space: 512MB
        Percent Used: 2%

Volume Groups Information
==============================================================================
Active VGs
==============================================================================
vg01:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk1            active            639         636         128..125..127..128..128
==============================================================================

rootvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk0            active            639         407         127..24..00..128..128
==============================================================================

INSTALLED RESOURCE LIST

The following resources are installed on the machine.
+/- = Added or deleted from Resource List.
*   = Diagnostic support not available.

  Model Architecture: chrp
  Model Implementation: Multiple Processor, PCI bus

+ sys0                                                                          System Object
+ sysplanar0                                                                    System Planar
* vio0                                                                          Virtual I/O Bus
* ent11            U9009.22A.7838470-V6-C18-T1                                  Virtual I/O Ethernet Adapter (l-lan)
* ent10            U9009.22A.7838470-V6-C17-T1                                  Virtual I/O Ethernet Adapter (l-lan)
* ent9             U9009.22A.7838470-V6-C16-T1                                  Virtual I/O Ethernet Adapter (l-lan)
* ent8             U9009.22A.7838470-V6-C15-T1                                  Virtual I/O Ethernet Adapter (l-lan)
* ent7             U9009.22A.7838470-V6-C14-T1                                  Virtual I/O Ethernet Adapter (l-lan)
* ent6             U9009.22A.7838470-V6-C13-T1                                  Virtual I/O Ethernet Adapter (l-lan)
* ent5             U9009.22A.7838470-V6-C12-T1                                  Virtual I/O Ethernet Adapter (l-lan)
* ent4             U9009.22A.7838470-V6-C11-T1                                  Virtual I/O Ethernet Adapter (l-lan)
* ent3             U9009.22A.7838470-V6-C10-T1                                  Virtual I/O Ethernet Adapter (l-lan)
* ent0             U9009.22A.7838470-V6-C2-T1                                   Virtual I/O Ethernet Adapter (l-lan)
* vscsi0           U9009.22A.7838470-V6-C6-T1                                   Virtual SCSI Client Adapter
* ent2             U9009.22A.7838470-V6-C4-T1                                   Virtual I/O Ethernet Adapter (l-lan)
* ent1             U9009.22A.7838470-V6-C3-T1                                   Virtual I/O Ethernet Adapter (l-lan)
* vsa0             U9009.22A.7838470-V6-C0                                      LPAR Virtual Serial Adapter
* vty0             U9009.22A.7838470-V6-C0-L0                                   Asynchronous Terminal
+ fcs0             U9009.22A.7838470-V6-C5-T1                                   Virtual Fibre Channel Client Adapter
+ fscsi0           U9009.22A.7838470-V6-C5-T1                                   FC SCSI I/O Controller Protocol Device
* sfwcomm0         U9009.22A.7838470-V6-C5-T1-W0-L0                             Fibre Channel Storage Framework Comm
+ fcs1             U9009.22A.7838470-V6-C7-T1                                   Virtual Fibre Channel Client Adapter
+ fscsi1           U9009.22A.7838470-V6-C7-T1                                   FC SCSI I/O Controller Protocol Device
* sfwcomm1         U9009.22A.7838470-V6-C7-T1-W0-L0                             Fibre Channel Storage Framework Comm
+ fcs2             U9009.22A.7838470-V6-C8-T1                                   Virtual Fibre Channel Client Adapter
+ fscsi2           U9009.22A.7838470-V6-C8-T1                                   FC SCSI I/O Controller Protocol Device
* hdisk0           U9009.22A.7838470-V6-C8-T1-W500507680B33DC62-L0              MPIO IBM 2076 FC Disk
* sfwcomm2         U9009.22A.7838470-V6-C8-T1-W0-L0                             Fibre Channel Storage Framework Comm
+ fcs3             U9009.22A.7838470-V6-C9-T1                                   Virtual Fibre Channel Client Adapter
+ fscsi3           U9009.22A.7838470-V6-C9-T1                                   FC SCSI I/O Controller Protocol Device
* hdisk1           U9009.22A.7838470-V6-C9-T1-W500507680B32DB0A-L1000000000000  MPIO IBM 2076 FC Disk
* sfwcomm3         U9009.22A.7838470-V6-C9-T1-W0-L0                             Fibre Channel Storage Framework Comm
+ L2cache0                                                                      L2 Cache
+ mem0                                                                          Memory
+ proc0                                                                         Processor
```

```shell-session:パーティション情報
# lparstat -i
Node Name                                  : power1
Partition Name                             : power1-e3bb2eed-00000151
Partition Number                           : 6
Type                                       : Shared-SMT-8
Mode                                       : Uncapped
Entitled Capacity                          : 0.25
Partition Group-ID                         : 32774
Shared Pool ID                             : 0
Online Virtual CPUs                        : 1
Maximum Virtual CPUs                       : 2
Minimum Virtual CPUs                       : 1
Online Memory                              : 2048 MB
Maximum Memory                             : 4096 MB
Minimum Memory                             : 2048 MB
Variable Capacity Weight                   : 64
Minimum Capacity                           : 0.25
Maximum Capacity                           : 0.50
Capacity Increment                         : 0.01
Maximum Physical CPUs in system            : 20
Active Physical CPUs in system             : 20
Active CPUs in Pool                        : 19
Shared Physical CPUs in system             : 19
Maximum Capacity of Pool                   : 1900
Entitled Capacity of Pool                  : 1275
Unallocated Capacity                       : 0.00
Physical CPU Percentage                    : 25.00%
Unallocated Weight                         : 0
Memory Mode                                : Dedicated
Total I/O Memory Entitlement               : -
Variable Memory Capacity Weight            : -
Memory Pool ID                             : -
Physical Memory in the Pool                : -
Hypervisor Page Size                       : -
Unallocated Variable Memory Capacity Weight: -
Unallocated I/O Memory entitlement         : -
Memory Group ID of LPAR                    : -
Desired Virtual CPUs                       : 1
Desired Memory                             : 2048 MB
Desired Variable Capacity Weight           : 64
Desired Capacity                           : 0.25
Target Memory Expansion Factor             : -
Target Memory Expansion Size               : -
Power Saving Mode                          : Dynamic Power Savings (Favor Performance)
Sub Processor Mode                         : -
```

# インターフェースの起動・停止

```shell-session:停止すると、UPというキーワードが消える。
# ifconfig en10 down
# ifconfig en10
en10: flags=1e084862,814c0<BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),LARGESEND,CHAIN>
        inet 192.168.130.90 netmask 0xfffffff8 broadcast 192.168.130.95
         tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1

# ifconfig en10 up
# ifconfig en10
en10: flags=1e084863,814c0<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),LARGESEND,CHAIN>
        inet 192.168.130.90 netmask 0xfffffff8 broadcast 192.168.130.95
         tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1
```

# パケットキャプチャー

```shell-session:指定したインターフェース内全部のパケット
# tcpdump -i en1 -nn
```

```shell-session:ホスト指定
# tcpdump -i en1 host 10.192.27.2 -nn
```

```shell-session:ICMP指定
# tcpdump -i en1 icmp -nn
```

# VLAN-IDの確認

```shell-session:entstat
# entstat -d ent0 | grep -i VLAN
Invalid VLAN ID Packets: 0
Port VLAN ID:  2003
VLAN Tag IDs:  None
```

```shell-session:複数のインターフェースで一括取得
# for i in 0 1 2 3 4 5; do echo "ent${i}"; entstat -d ent${i} | grep -i VLAN; done
```

```bash:複数のインターフェースで一括取得（bash利用時）
bash-4.3# for i in {0..11}; do echo "ent${i}"; entstat -d ent${i} | grep -i VLAN; done
```

# lsdev

```shell-session:Adapter情報取得
# lsdev -Cc adapter
ent0   Available       Virtual I/O Ethernet Adapter (l-lan)
ent1   Available       Virtual I/O Ethernet Adapter (l-lan)
ent2   Available       Virtual I/O Ethernet Adapter (l-lan)
ent3   Available       Virtual I/O Ethernet Adapter (l-lan)
ent4   Available       Virtual I/O Ethernet Adapter (l-lan)
ent5   Available       Virtual I/O Ethernet Adapter (l-lan)
ent6   Available       Virtual I/O Ethernet Adapter (l-lan)
ent7   Available       Virtual I/O Ethernet Adapter (l-lan)
ent8   Available       Virtual I/O Ethernet Adapter (l-lan)
ent9   Available       Virtual I/O Ethernet Adapter (l-lan)
ent10  Available       Virtual I/O Ethernet Adapter (l-lan)
ent11  Available       Virtual I/O Ethernet Adapter (l-lan)
fcs0   Available C5-T1 Virtual Fibre Channel Client Adapter
fcs1   Available C7-T1 Virtual Fibre Channel Client Adapter
fcs2   Available C8-T1 Virtual Fibre Channel Client Adapter
fcs3   Available C9-T1 Virtual Fibre Channel Client Adapter
pkcs11 Available       ACF/PKCS#11 Device
vsa0   Available       LPAR Virtual Serial Adapter
vscsi0 Available       Virtual SCSI Client Adapter
```

#サポートログ(snap)の取得

```shell-session

古い情報を削除
# snap -r

新規取得（作成された情報はsnap.pax.Zに固められる）
# snap -ac

# ls -l /tmp/ibmsupt/snap.pax.Z
-rw-------    1 root     system     53459365 Mar 09 21:55 /tmp/ibmsupt/snap.pax.Z
```