TCP のチューニング・パラメータは、以下のコマンドで取得できます。
なお、以下は Solaris 2.6 のものですが、 ndd は Solaris 2.5 より利用可能です。
> /usr/sbin/ndd /dev/tcp \? tcp_close_wait_interval (read and write) tcp_conn_req_max_q (read and write) tcp_conn_req_max_q0 (read and write) tcp_conn_grace_period (read and write) tcp_cwnd_max (read and write) tcp_debug (read and write) tcp_smallest_nonpriv_port (read and write) tcp_ip_abort_cinterval (read and write) tcp_ip_abort_linterval (read and write) tcp_ip_abort_interval (read and write) tcp_ip_notify_cinterval (read and write) tcp_ip_notify_interval (read and write) tcp_ip_ttl (read and write) tcp_keepalive_interval (read and write) tcp_maxpsz_multiplier (read and write) tcp_mss_def (read and write) tcp_mss_max (read and write) tcp_mss_min (read and write) tcp_naglim_def (read and write) tcp_old_urp_interpretation (read and write) tcp_rexmit_interval_initial (read and write) tcp_rexmit_interval_max (read and write) tcp_rexmit_interval_min (read and write) tcp_wroff_xtra (read and write) tcp_deferred_ack_interval (read and write) tcp_snd_lowat_fraction (read and write) tcp_sth_rcv_hiwat (read and write) tcp_sth_rcv_lowat (read and write) tcp_dupack_fast_retransmit (read and write) tcp_ignore_path_mtu (read and write) tcp_rwin_credit_pct (read and write) tcp_rcv_push_wait (read and write) tcp_smallest_anon_port (read and write) tcp_largest_anon_port (read and write) tcp_xmit_hiwat (read and write) tcp_xmit_lowat (read and write) tcp_recv_hiwat (read and write) tcp_recv_hiwat_minmss (read and write) tcp_fin_wait_2_flush_interval (read and write) tcp_co_min (read and write) tcp_max_buf (read and write) tcp_zero_win_probesize (read and write) tcp_strong_iss (read and write) tcp_rtt_updates (read and write) tcp_slow_start_initial (read and write) tcp_status (read only) tcp_bind_hash (read only) tcp_listen_hash (read only) tcp_conn_hash (read only) tcp_queue_hash (read only)
> /usr/sbin/ndd /dev/tcp tcp_close_wait_interval (lower sun 6) > /usr/sbin/ndd /dev/tcp tcp_time_wait_interval (upper sun 6) 240000
> /usr/sbin/ndd -set /dev/tcp tcp_close_wait_interval 1000 (lower sun 6) > /usr/sbin/ndd -set /dev/tcp tcp_time_wait_interval 60000 (upper sun 6)
以下に機能別のチューニング・パラメータを列挙します。
時間間隔の単位はミリ秒で、サイズの単位はバイトです。
![]() |
![]() |
| パラメータ | 意 味 | 既定値 | 推奨値 |
|---|---|---|---|
| tcp_conn_req_max_q0 | 接続確立中の接続処理中のキュー最大サイズ 接続要求を受信すると、保留状態の TCP 接続数が、 そのリスナーに対する (N) を超えているか調べます。 超えている場合は、その要求は拒否されます。 超えない場合は、保留状態の TCP 接続数が N と tcp_conn_req_max_q0 の合計を超えていないか調べます。超えていなければ、その要求は受け付けられます。 超えていると、最も古い保留状態の要求がドロップされます。 tcpListenDropQ0 が多い場合は、大きくします |
1024 | 1024<=x<=10240 |
| tcp_conn_req_max_q | 接続確立時の接続完了キュー最大サイズ 保留状態の TCP 接続の数が多すぎて AP が処理できないで、 新たな着信要求が拒否されることがあります。 tcpListenDrop が多い場合は、大きくします |
128 | 128<=x<=tcp_conn_req_max_q0 |
| tcp_conn_req_min | 接続確立時の接続完了キュー最小サイズ | 1 | 変更不可 |
![]() |
![]() |
| パラメータ | 意 味 | 既定値 | 推奨値 | 最大値 |
|---|---|---|---|---|
| tcp_rexmit_interval_initial | 最初の再送までの待時間 | 3000 | >=2000 | |
| tcp_rexmit_interval_min | 再送待ち時間の最小値 | 200 | >=1000 | |
| tcp_rexmit_interval_max | 再送待ち時間の最大値 tcp_time_wait_interval (2MSL) も関連あり |
240000 60000 |
240000 60000 | solaris2.6 solaris 8 |
| tcp_deferred_ack_interval | 遅延 ACK を送信するまでの時間 ネットワークリンクが遅く最大セグメントサイズが 512 バイトを超え、 複数の TCP セグメントを受信するには短すぎる場合、増やします |
100 | 200 | 500 |
| tcp_deferred_acks_max | 遅延 ACK を送信するまでの受信セグメント数 0/1 の場合はセグメントが 1MSS の長さとみなされ、遅延 ACK はありません。 通常この値は変更しませんが、トラフィックが著しく混雑する状況では、 この値を減らします。ただし、2 より小さくしないでください。 |
8 | 2<= <=16 | 16 |
| tcp_slow_start_initial | 輻輳ウィンドウの初期最大サイズ値(単位:MSS) この値は変更しないでください |
4 | 1 <= <= 4 | - |
| tcp_slow_start_after_idle | 輻輳ウィンドウが1再送タイムアウト間遊休後の輻輳ウィンドウ(単位:MSS) | 4 | 1<= <=16384 | - |
| tcp_dupack_fast_retransmit | セグメント消失と解釈する重複 ACK の数 | 3 | - | |
| tcp_rtt_updates | RTT パラメータをキャッシュするか | 0 | - | |
| ip_ire_cleanup_interval | ARP ルーチン表更新時間間隔 | 30000 | - |
![]() |
![]() |
| パラメータ | 意 味 | 既定値 | 推奨値 |
|---|---|---|---|
| ip_ire_pathmtu_interval | パス MTU 検査間隔 | 600000 | - |
| ip_path_mtu_discovery | パス MTU スイッチ (DF ビット) | 1 | 1 |
| tcp_ignore_path_mtu | デバッグ・オプション | 0 | 0 |
| tcp_mss_def | セグメント・サイズ最大値の既定値 | 563 | >=536 |
| tcp_mss_max | セグメント・サイズ最大値の最大 | 65495 | |
| tcp_mss_min | セグメント・サイズ最大値の最小 | 1 | |
| tcp_zero_win_probesize | ゼロ・ウィンドウ検査セグメント・サイズ | 1 | 1 |
![]() |
![]() |
| パラメータ | 意 味 | 既定値 | 推奨値 | 注 |
|---|---|---|---|---|
| tcp_keepalive_interval | 接続が維持されているか検査する時間間隔 | 7200000 (2h) | 0<=x<=∞ | |
| tcp_close_wait_interval | TIME_WAIT で待つ時間 | 240000 (4m) | 60000 | solaris 6 <= |
| tcp_time_wait_interval | TIME_WAIT で待つ時間 | 240000 (4m) | 60000 (1m) | solaris 7 >= |
| tcp_fin_wait_2_flush_interval | FIN_WAIT_2 で待つ時間 | 675000 | 67500 | |
| tcp_ip_abort_interval | 接続完了後、アボートまでの時間 | 480000 (8m) | 600000 | |
| tcp_ip_abort_cinterval | 接続時、リセットまでの時間 SYN-flood 攻撃を受けたときなど有効 |
240000 | ? |
![]() |
![]() |
| パラメータ | 意 味 | 既定値 | 推奨値 |
|---|---|---|---|
| ip_forward_src_routed | ソース・ルーティングを ON にする | 1 | 0 |
| ip_forward_directed_broadcasts | 1 | 0 | |
| ip_forwarding | 2 | 0 | |
| ip_respond_to_echo_broadcast | 1 | - | |
| ip_icmp_err_interval | 2 つの連続した ICMP エラー応答の時間間隔 | 500 | - |
| udp_smallest_anon_port | UDP 短命ポート番号最小値 | 32768 | 8192 |
| tcp_smallest_anon_port | TCP 短命ポート番号最小値 | 32768 | 8192 |
| udp_largest_anon_port | UDP 短命ポート番号最大値 | 65535 | - |
| tcp_smallest_nonpriv_port | TCP 非特権ポート番号最小値 | 1024 |
![]() |
![]() |
| パラメータ | 意 味 | 既定値 | 推奨値 | 最大値 (小) |
|---|---|---|---|---|
| tcp_deferred_acks_max | 遅延 ACK 送信後に受信するセグメントの最大数 | 8 | ? | 16 |
| tcp_cwnd_max | 輻輳ウインドウ最大サイズ tcp_max_buf は tcp_cwnd_max より大きくなければなりません。 | 1048576 | 65534 | |
| tcp_recv_hiwat | 接続時の受信ウインドウ最大サイズ AP で SO_RCVBUF を使って接続ごとに変更できます |
24576 | 16384 | 1073741824 |
| udp_recv_hiwat | UDP 受信ウインドウ最大サイズ | 8192 | 16384 | 65535 |
| tcp_recv_hiwat_minmss | 受信ウインドウ最大サイズに影響する MSS 最小サイズ | 4 | なし | |
| tcp_xmit_hiwat | 接続時の送信ウインドウ最大サイズ AP では SO_SNDBUF を使って接続ごとに変更できます |
16384 | 16384 | 1073741824 |
| udp_xmit_hiwat | UDP 送信ウインドウ最大サイズ | 8192 | 16384 | 65535 |
| tcp_xmit_lowat | TCP 送信ウインドウ最小サイズ | 2048 | なし | |
| udp_xmit_lowat | UPD 送信ウインドウ最小サイズ | 1024 | なし | |
| tcp_max_buf | TCP バッファの最大サイズ AP では setsockopt() を使って接続ごとに変更できます。 高速ネットワーク環境では速度に合わせて増やします | 1048576 | なし | (65536) |
| udp_max_buf | UPD バッファの最大サイズ | 1048576 | なし | (65536) |
![]() |
![]() |
| パラメータ | 意 味 | 既定値 | 推奨値 | 最大値 |
|---|---|---|---|---|
| tcp_ip_abort_linterval | 180000 | |||
| tcp_ip_notify_cinterval | アクティブ・オープン時ルートを決めるまでの時間 | 10000 | ||
| tcp_ip_notify_interval | 接続確立時ルートを決めるまでの時間 | 10000 | ||
| tcp_rexmit_interval_extra | 0 | |||
| tcp_sth_rcv_lowat | 0 | |||
| tcp_conn_hash | 接続のためのハッシュ表のサイズ:2 の累乗に 接続数が万単位の場合、大きくすべき |
512 | | 1073741824 |
| tcp_conn_hash_size | 接続のためのハッシュ表のサイズ:2 の累乗に 接続数が万単位の場合、大きくすべき |
256 | 262144 | 1073741824 |
![]() |
![]() |
touch /etc/init.d/nddconfig ln -s /etc/init.d/nddconfig /etc/rc2.d/S70nddconfig
接続数が1000未満で、セキュリテイがそんなに問題にならない場合の例です。
セキュリティが問題である場合は、以下のスクリプトの
SECURITY="YES" にしてください。
また、接続数が1000を超える場合は、
以下のパラメータを適宜調整する必要があります。
#!/sbin/sh
############################################################################
# $Id: nettune,v 3.1 1999/03/15 21:17:33 chouanar Exp chouanar $
#
# UNIT : mill sec
############################################################################
#
# /etc/rcS.d/S31nettune -> /etc/init.d/nettune
#
# See : http://www.rvs.uni-hannover.de/people/voeckler/tune/EN/your-tune
# and : http://www.rvs.uni-hannover.de/people/voeckler/tune/EN/tune.html
#
PATH=/usr/sbin:/usr/bin
/usr/ucb/echo -n "Tweaking Solaris TCP/IP: "
SECURITY="YES"
# determine, if SunOS 5.6 (Solaris 2.6) or above is installed (care w/ 2.5.1!)
osver=`uname -r | sed 's/\.//' | awk '{ print $1*10 }'`
# determine, if patch 10358[123]-12 or above is installed (2.5.1: x86+Sparc)
# if you are using Solaris < 2.5.1, you must modify this to suit your needs.
# since /var is usually not yet mounted, we must look into the kernel module.
patch=`strings -a /kernel/drv/tcp | egrep '10358[123]' | awk '{ print $4 }'`
if [ -z "$patch" ]; then patch="0-0"; fi
patch=`echo $patch | awk -F- '{ print $2*1 }'`
# report your findings (for Solari < 2.6 only)
if [ $osver -lt 560 ]; then
if [ $patch -gt 0 ]; then
/usr/ucb/echo -n "TCP patch pl-$patch found "
if [ $patch -ge 12 ]; then
echo "(good)"
else
echo "(too low)"
fi
else
echo "TCP patch missing (bad)"
fi
elif [ $osver -gt 560 ]; then
echo "Solaris 7 or above (excellent)"
else
echo "Solaris 2.6 (good)"
fi
#
# connection Q: *INCREASE* if you suffer from SYN floods, or many drops...
#
# tcp_conn_req_max_q 128
# tcp_conn_req_max_q0 1024
#
if [ $osver -ge 560 -o $patch -ge 12 ]; then
# Solaris 2.6 *OR* patch 103582-12 or above applied
echo " tweaking separate connection queues"
ndd -set /dev/tcp tcp_conn_req_max_q 512 # 128 for restrictions
if [ "YES${SECURITY}" = "YESYES" ] ; then
# use 10240 for SYN flood symptom treatment
echo " tweaking against SYN flood symptoms"
ndd -set /dev/tcp tcp_conn_req_max_q0 10240
else
ndd -set /dev/tcp tcp_conn_req_max_q0 1024
fi
else
# Solaris 2.5.1 or below, no patch
echo " tweaking single connection queue"
ndd -set /dev/tcp tcp_conn_req_max 512 # Hmmm, how about 1024
fi
#
# retransmission timeouts
#
# tcp_rexmit_interval_initial 3000
# tcp_rexmit_interval_min 200
# tcp_ip_abort_interval 480000 480sec=5min
# tcp_ip_abort_cinterval 180000
# tcp_rexmit_interval_max 60000
#
echo " tweaking timeouts"
ndd -set /dev/tcp tcp_rexmit_interval_initial 3000 # 500 for laboratories
ndd -set /dev/tcp tcp_rexmit_interval_min 10000 # 10sec for laboratories
ndd -set /dev/tcp tcp_ip_abort_interval 60000 # 60 sec before drop
ndd -set /dev/tcp tcp_ip_abort_cinterval 60000 # 60 seconds to estab. conn.
ndd -set /dev/tcp tcp_rexmit_interval_max 240000 # RFC instead of 2MSL
#
# slow start bug / feature
#
# tcp_slow_start_initial 2
# tcp_slow_start_after_idle 2
#
if [ $osver -ge 560 -o $patch -ge 15 ]; then
# Solaris 2.6 *OR* patch 103582-15 or above applied
echo " tweaking slow start bug/feature"
ndd -set /dev/tcp tcp_slow_start_initial 2
fi
#
# path MTU discovery, common timers
#
# ip_ire_pathmtu_Interval 600000
# tcp_keepalive_interval 72000000 72000sec=120min=2h
# tcp_fin_wait_2_flush_interval 675000
# tcp_time_wait_interval 240000
#
echo " tweaking pMTU discovery interval and common timers"
ndd -set /dev/ip ip_ire_pathmtu_interval 600000
ndd -set /dev/tcp tcp_keepalive_interval 3600000
ndd -set /dev/tcp tcp_fin_wait_2_flush_interval 67500
if [ $osver -le 560 ] ; then
# Before Solaris 7
ndd -set /dev/tcp tcp_close_wait_interval 60000 # 2MSL value
else
# Solaris 7 have change the name. It's now named for for it does.
ndd -set /dev/tcp tcp_time_wait_interval 60000 # 2MSL value
fi
#
# common parameters
#
# ip_icmp_err_interval 500
# ip_forward_src_routed 1
# tcp_smallest_anon_port 32768
# udp_smallest_anon_port 32768
#
echo " tweaking misc. parameters"
ndd -set /dev/ip ip_icmp_err_interval 0
ndd -set /dev/ip ip_forward_src_routed 0
ndd -set /dev/tcp tcp_smallest_anon_port 8192
ndd -set /dev/udp udp_smallest_anon_port 8192
#
# security relevant features
#
# ip_forward_directed_broadcasts 1
# ip_forwarding 2
# ip_respond_to_echo_broadcast 1
# ip_ignore_redirect 0
# ip_send_redirects 1
# ip_ire_flush_interval 1200000
# arp_cleanup_interval 300000 300sec=5min
# ip_strict_dst_multihoming 0
#
if [ "YES${SECURITY}" = "YESYES" ] ; then
echo " applying security tweaks..."
# pointed out by Jean Chouanard (see Stevens 12.3 and E.4):
# - uncomment, if you don't want to forward pings or other broadcasts
# to the broadcast address(es) of your installed interface(s).
ndd -set /dev/ip ip_forward_directed_broadcasts 0
# - uncomment, if you have multiple interfaces installed, but don't
# want to act as a router (no forwarding). Reasonable for most hosts.
ndd -set /dev/ip ip_forwarding 0
# - uncomment, if you don't want to respond to a ping to any of your
# broadcast addresses. On one hand, it is rumored to have caused panics.
# On the other hand, it is a valid response, and often used to determine
# the UP hosts on a particular network.
ndd -set /dev/ip ip_respond_to_echo_broadcast 0
# - For ICMP redirect protection
ndd -set /dev/ip ip_ignore_redirect 1
ndd -set /dev/ip ip_send_redirects 0
# Next 3 from Titan ( See http://www.fish.com/titan/ )
# - Unconditionally flush ARP info from IP routing table
ndd -set /dev/ip ip_ire_flush_interval 120000
# - discard ARP entry from ARP cache after this interval
#ndd -set /dev/arp arp_cleanup_interval 60000
# - Enable the 'strong end system' model from RFC 1122
ndd -set /dev/ip ip_strict_dst_multihoming 1
fi
#
# windows
#
# udp_xmit_hiwat 8192
# udp_recv_hiwat 8192
# tcp_xmit_hiwat 8192
# tcp_recv_hiwat 8192
#
echo " tweaking windows, buffers and watermarks"
ndd -set /dev/udp udp_xmit_hiwat 16384 # max. UDP PDU size for sending
ndd -set /dev/udp udp_recv_hiwat 64000 # queue for UDP
ndd -set /dev/tcp tcp_xmit_hiwat 32768 # Cockroft's recommendation
ndd -set /dev/tcp tcp_recv_hiwat 32768 # Cockroft's recommendation
# Note:
# Under 2.6 you can use tcp_host_param to boost just selected networks
# See: http://www.rvs.uni-hannover.de/people/voeckler/tune/EN/tune.html#thp
#
echo "done."
![]() |
![]() |