RHEL8とRHEL9のネットワーク設定の違い

Linux

この記事ではRHEL8とRHEL9 でのネットワークの設定の違いについてまとめました。

RHEL 9 ネットワーキング:ifcfg ファイルからキーファイルへ
デフォルトでは、NetworkManager はキーファイル形式を使用して新しい接続プロファイルを保存するようになりました。ただし、ifcfg 形式も引き続きサポートされます。

RHEL9.5のデフォルトのNetworkManager.confの中身は以下。

[root@RHEL95 ~]# cat /etc/NetworkManager/NetworkManager.conf
# Configuration file for NetworkManager.
#
# See "man 5 NetworkManager.conf" for details.
#
# The directories /usr/lib/NetworkManager/conf.d/ and /run/NetworkManager/conf.d/
# can contain additional .conf snippets installed by packages. These files are
# read before NetworkManager.conf and have thus lowest priority.
# The directory /etc/NetworkManager/conf.d/ can contain additional .conf
# snippets. Those snippets are merged last and overwrite the settings from this main
# file.
#
# The files within one conf.d/ directory are read in asciibetical order.
#
# You can prevent loading a file /usr/lib/NetworkManager/conf.d/NAME.conf
# by having a file NAME.conf in either /run/NetworkManager/conf.d/ or /etc/NetworkManager/conf.d/.
# Likewise, snippets from /run can be prevented from loading by placing
# a file with the same name in /etc/NetworkManager/conf.d/.
#
# If two files define the same key, the one that is read afterwards will overwrite
# the previous one.

[main]
#plugins=keyfile,ifcfg-rh


[logging]
# When debugging NetworkManager, enabling debug logging is of great help.
#
# Logfiles contain no passwords and little sensitive information. But please
# check before posting the file online. You can also personally hand over the
# logfile to a NM developer to treat it confidential. Meet us on #nm on Libera.Chat.
#
# You can also change the log-level at runtime via
#   $ nmcli general logging level TRACE domains ALL
# However, usually it's cleaner to enable debug logging
# in the configuration and restart NetworkManager so that
# debug logging is enabled from the start.
#
# You will find the logfiles in syslog, for example via
#   $ journalctl -u NetworkManager
#
# Please post full logfiles for bug reports without pre-filtering or truncation.
# Also, for debugging the entire `journalctl` output can be interesting. Don't
# limit unnecessarily with `journalctl -u`. Exceptions are if you are worried
# about private data. Check before posting logfiles!
#
# Note that debug logging of NetworkManager can be quite verbose. Some messages
# might be rate-limited by the logging daemon (see RateLimitIntervalSec, RateLimitBurst
# in man journald.conf). Please disable rate-limiting before collecting debug logs!
#
#level=TRACE
#domains=ALL

RHEL9からkeyfile形式でのネットワークの定義ファイルが優先される

RHEL9ではネットワークの設定でkeyfile形式のファイルを優先的に処理します。

[root@RHEL95 ~]# cat /etc/NetworkManager/NetworkManager.conf
(中略)
[main]
#plugins=keyfile,ifcfg-rh
(中略)

#でコメントアウトされているpluginsのパラメータをifcfg-rhに変えることでifcfg形式の定義ファイルでもネットワークの設定を読み込みます。

RHEL8までのifcfg形式もRHEL9では対応しているが非推奨

前述の通り、/etc/NetworkManager/NetworkManager.confでifcfg形式の定義ファイルも仕様できますが、RHEL9では非推奨です。

RHEL 9 ネットワーキング:ifcfg ファイルからキーファイルへ
デフォルトでは、NetworkManager はキーファイル形式を使用して新しい接続プロファイルを保存するようになりました。ただし、ifcfg 形式も引き続きサポートされます。

NetworkManager.confの中身がRHEL8とRHEL9で若干異なる

RHEL8.10のNetworkManager.confファイルの中身は以下です。

[root@RHEL810 ~]# cat /etc/NetworkManager/NetworkManager.conf
# Configuration file for NetworkManager.
#
# See "man 5 NetworkManager.conf" for details.
#
# The directories /usr/lib/NetworkManager/conf.d/ and /run/NetworkManager/conf.d/
# can contain additional .conf snippets installed by packages. These files are
# read before NetworkManager.conf and have thus lowest priority.
# The directory /etc/NetworkManager/conf.d/ can contain additional .conf
# snippets. Those snippets are merged last and overwrite the settings from this main
# file.
#
# The files within one conf.d/ directory are read in asciibetical order.
#
# You can prevent loading a file /usr/lib/NetworkManager/conf.d/NAME.conf
# by having a file NAME.conf in either /run/NetworkManager/conf.d/ or /etc/NetworkManager/conf.d/.
# Likewise, snippets from /run can be prevented from loading by placing
# a file with the same name in /etc/NetworkManager/conf.d/.
#
# If two files define the same key, the one that is read afterwards will overwrite
# the previous one.

[main]
#plugins=ifcfg-rh


[logging]
# When debugging NetworkManager, enabling debug logging is of great help.
#
# Logfiles contain no passwords and little sensitive information. But please
# check before posting the file online. You can also personally hand over the
# logfile to a NM developer to treat it confidential. Meet us on #nm on Libera.Chat.
#
# You can also change the log-level at runtime via
#   $ nmcli general logging level TRACE domains ALL
# However, usually it's cleaner to enable debug logging
# in the configuration and restart NetworkManager so that
# debug logging is enabled from the start.
#
# You will find the logfiles in syslog, for example via
#   $ journalctl -u NetworkManager
#
# Please post full logfiles for bug reports without pre-filtering or truncation.
# Also, for debugging the entire `journalctl` output can be interesting. Don't
# limit unnecessarily with `journalctl -u`. Exceptions are if you are worried
# about private data. Check before posting logfiles!
#
# Note that debug logging of NetworkManager can be quite verbose. Some messages
# might be rate-limited by the logging daemon (see RateLimitIntervalSec, RateLimitBurst
# in man journald.conf). Please disable rate-limiting before collecting debug logs!
#
#level=TRACE
#domains=ALL

以下の通り、RHEL8とRHEL9でパラメータが異なります。RHEL9では、keyfile形式の定義ファイルが優先されます。

RHEL8.10

[main]
#plugins=ifcfg-rh

RHEL9.5

[main]
#plugins=keyfile,ifcfg-rh

keyfileとifcfgファイルの保存場所

RHEL9ではkeyfile形式で定義ファイルが保存されます。保存場所は以下です。

/etc/NetworkManager/system-connections/

keyfileの中身の一例です。

[root@RHEL95 system-connections]# cat ens160.nmconnection
[connection]
id=ens160
uuid=20f2450b-ffa2-302a-8142-7eb6b882a095
type=ethernet
autoconnect-priority=-999
interface-name=ens160
timestamp=1740946177

[ethernet]

[ipv4]
method=auto

[ipv6]
addr-gen-mode=eui64
method=auto

[proxy]

RHEL8ではifcfg形式でファイルが保存されます。保存場所は以下です。

/etc/sysconfig/network-scripts

ifcfg形式のファイルは以下のように記載されます。

[root@RHEL810 network-scripts]# cat ifcfg-ens160
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=eui64
NAME=ens160
UUID=b53a0af8-43c2-474c-8492-4c193d8f6227
DEVICE=ens160
ONBOOT=yes

ルーティングの設定方法が異なる

RHEL8とRHEL9ではルーティングの設定方法が異なります。

タイトルとURLをコピーしました