Show Table of Contents
1.11. netconsole の設定
netconsole カーネルモジュールにより、カーネルメッセージをネットワークを通じて他のコンピューターに記録することができます。これにより、ディスクへの記録に失敗した場合やシリアルコンソールの使用が不可能な場合に、カーネルのデバッグを行うことができます。
rsyslog サーバーがネットワーク上にあり、rsyslogd デーモンが 514/udp ポートをリッスンしている必要があります。514/udp ポートをリッスンしてネットワークからメッセージを受信するように rsyslogd を設定するには、/etc/rsyslog.conf の MODULES セクションで、以下の行をアンコメントします。
$ModLoad imudp $UDPServerRun 514
rsyslogd サービスを再起動して、変更を有効にします。
]# systemctl restart rsyslogrsyslogd が 514/udp ポートをリッスンしていることを確認するには、以下のコマンドを使用します。
]# netstat -l | grep syslog
udp 0 0 0.0.0.0:syslog 0.0.0.0:*
udp6 0 0 [::]:syslog [::]:*netstat -l により 0.0.0.0:syslog および [::]:syslog の値が出力されていますが、これは rsyslogd が /etc/services ファイルで定義されるデフォルトの netconsole ポートをリッスンしていることを意味します。
]$ cat /etc/services | grep syslog
syslog 514/udp
syslog-conn 601/tcp # Reliable Syslog Service
syslog-conn 601/udp # Reliable Syslog Service
syslog-tls 6514/tcp # Syslog over TLS
syslog-tls 6514/udp # Syslog over TLS
syslog-tls 6514/dccp # Syslog over TLS送信元マシンの設定
Red Hat Enterprise Linux 7 では、
netconsole は initscripts パッケージに含まれ、ファイル /etc/sysconfig/netconsole を使って設定します。このパッケージはデフォルトでインストールされ、netconsole サービスも提供します。
送信元マシンを設定するには、
/etc/sysconfig/netconsole ファイルの SYSLOGADDR 変数の値を、syslogd サーバーの IP アドレスに設定します。以下に例を示します。
SYSLOGADDR=192.168.0.1
netconsole サービスを再起動して、変更を有効にします。続いて、次の再起動後に再実行されるように netconsole.service を有効にします。
]#systemctl restart netconsole.service]#systemctl enable netconsole.service
デフォルトでは、
rsyslogd サーバーは、クライアントからの netconsole メッセージを /var/log/messages または rsyslog.conf で指定したファイルに書き込みます。
注記
別のポートを使用するように
rsyslogd および netconsole.service を設定するには、/etc/rsyslog.conf の以下の行を希望するポート番号に変更します。
$UDPServerRun <PORT>
送信元マシンで、
/etc/sysconfig/netconsole ファイルの以下の行をアンコメントして編集します。
SYSLOGPORT=514
netconsole 設定の詳細およびトラブルシューティングのヒントについては、Netconsole カーネルのドキュメント を参照してください。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.