Last Updated on 2023年5月3日 by かんりにん
社内で利用しているアプリケーションのセッションが一定時間操作がない状態で切れてしまうため、回避のため設定を追加。
具体的にはTCPセッションにて、指定したポートの通信タイムアウトを指定する方法。
環境
- model
SRX220H2 - Firmware
JUNOS 12.1X44-D25.5
まずデフォルトのタイムアウト設定を確認したところ、
TCPは30分、UDPで1分という設定がされている様子。
1)プリセットされた設定情報の確認
せっかくなのでpre-definedのアプリケーションに対する設定をちょっと見てみる。
rootでログインしてcliモードへ変更
root@host-A% cli
プリセットされた設定の確認
root@host-A% request pfe execute target fwdd command "show usp app-def tcp" SENT: Ukern command: show usp app-def tcp GOT: GOT: tcp port=0, appl_name=junos-tcp-any, service type=0, alg id=0, timeout=1800 GOT: tcp port=21, appl_name=junos-ftp, service type=1, alg id=1, timeout=1800 GOT: tcp port=22, appl_name=junos-ssh, service type=22, alg id=0, timeout=1800 GOT: tcp port=23, appl_name=junos-telnet, service type=10, alg id=0, timeout=1800 GOT: tcp port=25, appl_name=junos-smtp, service type=7, alg id=0, timeout=1800 GOT: tcp port=43, appl_name=junos-whois, service type=46, alg id=0, timeout=1800 GOT: tcp port=49, appl_name=junos-tacacs, service type=0, alg id=0, timeout=1800 GOT: tcp port=53, appl_name=junos-dns-tcp, service type=16, alg id=16, timeout=1800 GOT: tcp port=65, appl_name=junos-tacacs-ds, service type=0, alg id=0, timeout=1800 GOT: tcp port=70, appl_name=junos-gopher, service type=39, alg id=0, timeout=1800 GOT: tcp port=79, appl_name=junos-finger, service type=17, alg id=0, timeout=1800 GOT: tcp port=80, appl_name=junos-http, service type=6, alg id=6, timeout=300 GOT: tcp port=110, appl_name=junos-pop3, service type=8, alg id=0, timeout=1800 GOT: tcp port=111, appl_name=junos-sun-rpc-tcp, service type=5, alg id=5, timeout=2400 GOT: tcp port=113, appl_name=junos-ident, service type=34, alg id=0, timeout=1800 GOT: tcp port=119, appl_name=junos-nntp, service type=35, alg id=0, timeout=1800 GOT: tcp port=135, appl_name=junos-ms-rpc-tcp, service type=55, alg id=55, timeout=60 GOT: tcp port=139, appl_name=junos-smb, service type=21, alg id=0, timeout=1800 ・・・以下略
それぞれデフォルト値に設定されているので、変更する場合は以下を参考に。
- 参考:プリセットされたアプリケーションのタイムアウト設定を変更する場合
2)カスタム設定の追加
今回はpre-definedアプリでなく独自の設定を加えるので、source、destの各ポート設定とタイムアウトを指定して実行。
以下の例では、
- ポート30003番に対してソースはどこからでも受け付ける設定
- タイムアウトは6時間に設定。
として設定。
※運用上6時間という長さが適切かどうかは置いといて…
設定実行
root@host-A# set applications application test-policy protocol tcp source-port 0-65535 destination-port 30003-30003 inactivity-timeout 21600 {primary:node0}[edit] root@host-A#
→設定後にcommitを実行して適用。
root@host-A& commit
3)設定の確認
cliモードで”show configuration applications”を実行して、カスタム設定を確認。
root@host-A> show configuration applications application test-policy { protocol tcp; source-port 0-65535; destination-port 30003-30003; inactivity-timeout 21600; } {primary:node0} root@host-A>
上記で設定追加は終了。あとは対象のアプリにてセッションタイムアウトの状況を確認して、問題なければOK。