概要
ipvsadmのテーブルを設定し、サービスの再起動では設定情報をクリアーしてリストアできるのですが、OSを再起動するとテーブル情報がリストアされません。
OS再起動後も設定を維持する方法はありますでしょうか。
1.バージョン確認
# cat /etc/redhat-release Rocky Linux release 8.7 (Green Obsidian) # yum list installed | grep ipvsadm ipvsadm.x86_64 1.31-1.el8 @appstream # yum list installed | grep keepalived keepalived.x86_64 2.1.5-9.el8 @appstream
2.サービスの状態確認
# systemctl status ipvsadm ● ipvsadm.service - Initialise the Linux Virtual Server Loaded: loaded (/usr/lib/systemd/system/ipvsadm.service; enabled; vendor preset: disabled) Active: active (exited) since Tue 2022-12-13 11:18:36 JST; 2h 38min ago
3.サービススクリプト
# less /usr/lib/systemd/system/ipvsadm.service [Unit] Description=Initialise the Linux Virtual Server After=syslog.target network.target [Service] Type=oneshot ExecStart=/bin/bash -c "exec /sbin/ipvsadm-restore < /etc/sysconfig/ipvsadm" ExecStop=/bin/bash -c "exec /sbin/ipvsadm-save -n > /etc/sysconfig/ipvsadm" ExecStop=/sbin/ipvsadm -C RemainAfterExit=yes [Install] WantedBy=multi-user.target
4.テーブル設定を追加
# ipvsadm -L IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 192.168.100.100:http sh -> 192.168.100.101:http Route 1 0 0 -> 192.168.100.102:http Route 1 0 0 -> 192.168.100.103:http Route 1 0 0 -> 192.168.100.104:http Route 1 0 0 TCP 192.168.100.100:https sh -> 192.168.100.101:https Route 1 0 0 -> 192.168.100.102:https Route 1 0 0 -> 192.168.100.103:https Route 1 0 0 -> 192.168.100.104:https Route 1 0 0
5.サービス停止 -> ipvsadmテーブルの状態
# systemctl stop ipvsadm # ipvsadm -L IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn
6.サービス開始 -> ipvsadmテーブルの状態
# systemctl start ipvsadm # ipvsadm -L IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 192.168.100.100:http sh -> 192.168.100.101:http Route 1 0 0 -> 192.168.100.102:http Route 1 0 0 -> 192.168.100.103:http Route 1 0 0 -> 192.168.100.104:http Route 1 0 0 TCP 192.168.100.100:https sh -> 192.168.100.101:https Route 1 0 0 -> 192.168.100.102:https Route 1 0 0 -> 192.168.100.103:https Route 1 0 0 -> 192.168.100.104:https Route 1 0 0
7.OS再起動 -> ipvsadmテーブルの状態
# ipvsadm -L IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn
8.サービスの起動順序
サービスの起動順序を変更する方法もあるようですが、原因を特定出来ない状態です。
ご教授頂けますと助かります。

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。