Advertisement
Guest User

config

a guest
Aug 28th, 2022
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.65 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # CAKE-autorate automatically adjusts bandwidth for CAKE in dependence on detected load and RTT
  4.  
  5. # cake-autorate-config.sh is a script that sets up defaults for CAKE-autorate
  6.  
  7. # Author: @Lynx (OpenWrt forum)
  8. # Inspiration taken from: @moeller0 (OpenWrt forum)
  9.  
  10. cake_autorate_version="1.0.0"
  11.  
  12. # *** OUTPUT OPTIONS ***
  13.  
  14. output_processing_stats=1 # enable (1) or disable (0) output monitoring lines showing processing stats
  15. output_cake_changes=1     # enable (1) or disable (0) output monitoring lines showing cake bandwidth changes
  16. debug=1           # enable (1) or disable (0) out of debug lines
  17.  
  18. # *** STANDARD CONFIGURATION OPTIONS ***
  19.  
  20. dl_if=ifb4wwan0    # download interface
  21. ul_if=wwan0        # upload interface
  22.  
  23. reflector_ping_interval_s=0.2 # (seconds, e.g. 0.2s or 2s)
  24.  
  25. # list of reflectors to use and number of pingers to initiate
  26. # pingers will be initiated with reflectors in the order specified in the list
  27. # additional reflectors will be used to replace any reflectors that go stale
  28. # so e.g. if 6 reflectors are specified and the number of pingers is set to 4, the first 4 reflectors will be used initially
  29. # and the remaining 2 reflectors in the list will be used in the event any of the first 4 go bad
  30. # a bad reflector will go to the back of the queue on reflector rotation
  31. #reflectors=("1.1.1.1" "1.0.0.1" "8.8.8.8" "8.8.4.4" "9.9.9.9" "9.9.9.10" )
  32.  
  33. #st movist  santiago        punta arena     talca           concepcion     temuco
  34. reflectors=("200.29.48.201" "190.82.63.254" "200.28.11.238" "200.28.0.254" "200.28.12.254")
  35.  
  36. #speedtest   mundo          talcahuano  mundo concepcion
  37. #reflectors=("190.102.249.132" "170.150.159.36" "200.54.236.25" "200.54.125.238" "200.12.171.52" "200.7.7.3" "190.107.229.5")
  38. # dns servers in chile src : https://public-dns.info/nameserver/cl.html
  39. #reflectors=("204.199.130.93" "200.12.130.66" "186.67.67.10" "216.155.89.66" "186.103.224.226" "190.114.255.115")
  40.  
  41. no_pingers=4
  42.  
  43. # delay threshold in ms is the extent of RTT increase to classify as a delay
  44. # this is automatically adjusted based on maximum on the wire packet size
  45. # (adjustment significant at sub 12Mbit/s rates, else negligible)  
  46. delay_thr_ms=25 # (milliseconds)
  47.  
  48. min_dl_shaper_rate_kbps=1000  # minimum bandwidth for download (Kbit/s)
  49. base_dl_shaper_rate_kbps=7000 # steady state bandwidth for download (Kbit/s)
  50. max_dl_shaper_rate_kbps=37000  # maximum bandwidth for download (Kbit/s)
  51.  
  52. min_ul_shaper_rate_kbps=1000  # minimum bandwidth for upload (Kbit/s)
  53. base_ul_shaper_rate_kbps=7000 # steady state bandwidth for upload (KBit/s)
  54. max_ul_shaper_rate_kbps=37000  # maximum bandwidth for upload (Kbit/s)
  55.  
  56. # sleep functionality saves unecessary pings and CPU cycles by
  57. # pausing all active pingers when connection is not in active use
  58. enable_sleep_function=1 # enable (1) or disable (0) sleep functonality
  59. connection_active_thr_kbps=50 # threshold in Kbit/s below which dl/ul is considered idle
  60. sustained_idle_sleep_thr_s=60  # time threshold to put pingers to sleep on sustained dl/ul achieved rate < idle_thr (seconds)
  61.  
  62. startup_wait_s=5 # number of seconds to wait on startup (e.g. to wait for things to settle on router reboot)
  63.  
  64. # *** ADVANCED CONFIGURATION OPTIONS ***
  65.  
  66. # interval in ms for monitoring achieved rx/tx rates
  67. # this is automatically adjusted based on maximum on the wire packet size
  68. # (adjustment significant at sub 12Mbit/s rates, else negligible)  
  69. monitor_achieved_rates_interval_ms=200 # (milliseconds)
  70.  
  71. # bufferbloat is detected when (bufferbloat_detection_thr) samples
  72. # out of the last (bufferbloat detection window) samples are delayed
  73. bufferbloat_detection_window=4  # number of samples to retain in detection window
  74. bufferbloat_detection_thr=2     # number of delayed samples for bufferbloat detection
  75.  
  76. # RTT baseline against which to measure delays
  77. # the idea is that the baseline is allowed to increase slowly to allow for path changes
  78. # and slowly enough such that bufferbloat will be corrected well before the baseline increases,
  79. # but it will decrease very rapidly to ensure delays are measured against the shortest path
  80. alpha_baseline_increase=0.001 # how rapidly baseline RTT is allowed to increase
  81. alpha_baseline_decrease=0.9   # how rapidly baseline RTT is allowed to decrease
  82.  
  83. # rate adjustment parameters
  84. # bufferbloat adjustment works with the lower of the adjusted achieved rate and adjusted shaper rate
  85. # to exploit that transfer rates during bufferbloat provide an indication of line capacity
  86. # otherwise shaper rate is adjusted up on load high, and down on load idle or low
  87. # and held the same on load medium
  88. achieved_rate_adjust_down_bufferbloat=0.9 # how rapidly to reduce achieved rate upon detection of bufferbloat
  89. shaper_rate_adjust_down_bufferbloat=0.9   # how rapidly to reduce shaper rate upon detection of bufferbloat
  90. shaper_rate_adjust_up_load_high=1.01      # how rapidly to increase shaper rate upon high load detected
  91. shaper_rate_adjust_down_load_low=0.9      # how rapidly to return down to base shaper rate upon idle or low load detected
  92. shaper_rate_adjust_up_load_low=1.01       # how rapidly to return up to base shaper rate upon idle or low load detected
  93.  
  94. # the load is categoried as low if < medium_load_thr, medium if > medium_load_thr and high if > high_load_thr relative to the current shaper rate
  95. medium_load_thr=0.75 # % of currently set bandwidth for detecting medium load
  96. high_load_thr=0.75   # % of currently set bandwidth for detecting high load
  97.  
  98. # refractory periods between successive bufferbloat/decay rate changes
  99. # the bufferbloat refractory period should be greater than the
  100. # average time it would take to replace the bufferbloat
  101. # detection window with new samples upon a bufferbloat event
  102. bufferbloat_refractory_period_ms=300 # (milliseconds)
  103. decay_refractory_period_ms=1000 # (milliseconds)
  104.  
  105. # interval for checking reflector health
  106. reflector_health_check_interval_s=1 # (seconds)
  107. # deadline for reflector response not to be classified as an offence against reflector
  108. reflector_response_deadline_s=1 # (seconds)
  109.  
  110. # reflector misbehaving is detected when $reflector_misbehaving_detection_thr samples
  111. # out of the last (reflector misbehaving detection window) samples are offences
  112. # thus with a 1s interval, window 60 and detection_thr 3, this is tantamount to
  113. # 3 offences within the last 60s
  114. reflector_misbehaving_detection_window=60
  115. reflector_misbehaving_detection_thr=3
  116.  
  117. global_ping_response_timeout_s=10 # timeout to set shaper rates to min on no ping response whatsoever (seconds)
  118.  
  119. if_up_check_interval_s=10 # time to wait before re-checking if rx/tx bytes files exist (e.g. from boot state)
  120.  
  121.  
  122. # Starlink satellite switch (sss) compensation options
  123. sss_compensation=0 # enable (1) or disable (0) Starlink handling
  124. # satellite switch compensation start times in seconds of each minute
  125. sss_times_s=("12.0" "27.0" "42.0" "57.0")
  126. sss_compensation_pre_duration_ms=300
  127. sss_compensation_post_duration_ms=200
  128.  
  129. # verify these are correct using 'cat /sys/class/...'
  130. case "${dl_if}" in
  131.     \veth*)
  132.         rx_bytes_path="/sys/class/net/${dl_if}/statistics/tx_bytes"
  133.         ;;
  134.     \ifb*)
  135.         rx_bytes_path="/sys/class/net/${dl_if}/statistics/tx_bytes"
  136.         ;;
  137.     *)
  138.         rx_bytes_path="/sys/class/net/${dl_if}/statistics/rx_bytes"
  139.         ;;
  140. esac
  141.  
  142. case "${ul_if}" in
  143.     \veth*)
  144.         tx_bytes_path="/sys/class/net/${ul_if}/statistics/rx_bytes"
  145.         ;;
  146.     \ifb*)
  147.         tx_bytes_path="/sys/class/net/${ul_if}/statistics/rx_bytes"
  148.         ;;
  149.     *)
  150.         tx_bytes_path="/sys/class/net/${ul_if}/statistics/tx_bytes"
  151.         ;;
  152. esac
  153.  
  154. if (( $debug )) ; then
  155.     echo "DEBUG rx_bytes_path: $rx_bytes_path"
  156.     echo "DEBUG tx_bytes_path: $tx_bytes_path"
  157. fi
  158.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement