和6年能登半島地震により亡くなられた方々のご冥福をお祈りするとともに、被害に遭われた皆さまに対し、心よりお見舞い申し上げます。一日も早く被災地の安全が確保され、復旧が進む事を心よりお祈り申し上げます。

ifconfigコマンドは非推奨なのね

CentOS7からnet-toolsは、デフォルトでインストールされません。

# ifconfig
-bash: ifconfig: コマンドが見つかりません

以下、Questions about CentOS-7サイトより引用

7. What have you done with ifconfig/netstat?
The ifconfig and netstat utilities have been marked as deprecated in the man pages for CentOS 5 and 6 for nearly a decade and Redhat made the decision to no longer install the net-tools package by default in CentOS 7. One reason to switch is that ifconfig does not show all details of ip addresses assigned to interfaces – use the ip command instead. The replacement utilities are ss and ip. If you really really need ifconfig and netstat back then you can yum install net-tools.

ifconfig、netstatが必要な場合は、net-toolsをインストールすれば良い。とのこと。
iproute2 パッケージに含まれている ip 、 ss コマンドが推奨なのね。

# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:e0:a4:e5 brd ff:ff:ff:ff:ff:ff
inet 192.168.252.128/24 brd 192.168.252.255 scope global noprefixroute dynamic ens33
valid_lft 1373sec preferred_lft 1373sec
inet6 fe80::b642:d3e7:d269:6d7/64 scope link noprefixroute
valid_lft forever preferred_lft forever

「VMware Workstation 15 Player」のCentOS7でnet-toolsをインストールしてみる。

# yum -y install net-tools
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.jaist.ac.jp
* extras: ftp.jaist.ac.jp
* updates: ftp.jaist.ac.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ net-tools.x86_64 0:2.0-0.25.20131004git.el7 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

==========================================================================================
Package アーキテクチャー バージョン リポジトリー 容量
==========================================================================================
インストール中:
net-tools x86_64 2.0-0.25.20131004git.el7 base 306 k

トランザクションの要約
===========================================================================================
インストール 1 パッケージ

総ダウンロード容量: 306 k
インストール容量: 917 k
Downloading packages:
net-tools-2.0-0.25.20131004git.el7.x86_64.rpm | 306 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
インストール中 : net-tools-2.0-0.25.20131004git.el7.x86_64 1/1
検証中 : net-tools-2.0-0.25.20131004git.el7.x86_64 1/1

インストール:
net-tools.x86_64 0:2.0-0.25.20131004git.el7

完了しました!
# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.252.128 netmask 255.255.255.0 broadcast 192.168.252.255
inet6 fe80::b642:d3e7:d269:6d7 prefixlen 64 scopeid 0x20 ether 00:0c:29:e0:a4:e5 txqueuelen 1000 (Ethernet)
RX packets 253064 bytes 376731341 (359.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 33464 bytes 3182685 (3.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 64 bytes 5568 (5.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 64 bytes 5568 (5.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

使い慣れたコマンドに依存しちゃうな。
推奨コマンドのオプション含めて覚えるのが正解だよね。