maghuro
Very Senior Member
+1We need freshjr to return to us, personally I actually quite miss him and his QoS wisdom.
For us with poor internet connections, qos makes miracles...
+1We need freshjr to return to us, personally I actually quite miss him and his QoS wisdom.
Hope @FreshJR is doing well...anyone know if he's doing well?+1
For us with poor internet connections, qos makes miracles...
I really don't know if spdMerlin interfere with the speed test, probably yes, but I'm writing to say that as you, my internet speed fluctuates a lot, as unfortunately I'm using 4G for internet access.Hello. I have ATT fixed wireless internet and the speed can unfortunately fluctuate (sometimes significantly). They guarantee at least 1Mbps up and 10MBps down and for the most part it is above those limits. I am using a script and spdMerlin data to set the QoS bandwidth limits (with FreshJr mods) to try an account for those fluctuations. So, my question is, should QoS be disabled before running spdMerlin or will it not interfere with the speedtest? I don't want new limits that are influenced by the "old" or existing limits do I? Thanks.
Sure, no problem. Let me clean it up a bit and I will share it. Please understand that I am far from being a good coder, but it is working as expected so far. It uses bash and bc as well as spdMerlin or course. I use cron to run the script approx. 3-4 times a day ... during each execution of the script I take the average of 3 (user definable) speMerlin values and then set qos_obw and qos_ibw to those average values.I really don't know if spdMerlin interfere with the speed test, probably yes, but I'm writing to say that as you, my internet speed fluctuates a lot, as unfortunately I'm using 4G for internet access.
So, if you don't mind, I'd love to have the script you wrote to define the qos based on speed test. That would be awesome!
Perfect!Sure, no problem. Let me clean it up a bit and I will share it. Please understand that I am far from being a good coder, but it is working as expected so far. It uses bash and bc as well as spdMerlin or course. I use cron to run the script approx. 3-4 times a day ... during each execution of the script I take the average of 3 (user definable) speMerlin values and then set qos_obw and qos_ibw to those average values.
Or at least it should be, because I think any traffic from router bypasses QoS.AFAIK it bypasses QoS
That's my reasoning tooOr at least it should be, because I think any traffic from router bypasses QoS.
At least this traffic doesn't show on QoS page!
Maybe you can share to us all hereSure, no problem. Let me clean it up a bit and I will share it. Please understand that I am far from being a good coder, but it is working as expected so far. It uses bash and bc as well as spdMerlin or course. I use cron to run the script approx. 3-4 times a day ... during each execution of the script I take the average of 3 (user definable) speMerlin values and then set qos_obw and qos_ibw to those average values.
I hope this helps somebody ... works ok for me. Again, I am not very proficient at coding, just needed something that works for me.Maybe you can share to us all here
Really would appreciated.
#!/opt/bin/bash
######################################################################
# SET-BW-SPEEDS
# Set QoS upload/download speeds using Ookla speedtests and spdMerlin
# Requires bash, bc, and spdMerlin
######################################################################
#Make sure speeds (before scaling) are within these boundaries
# Mainly just to prevent bandwidth from being set too low
# (or too high)... not worried about upper limit but it is there
# for the sake of completeness
download_lower_limit=10 #Mbps
download_upper_limit=50 #Mbps
upload_lower_limit=1.0 #Mbps
upload_upper_limit=50 #Mbps
#Scale average values by this factor
#Adjust to optimize bufferbloat and quality grade at DSLreports.com
down_scale_factor=0.85
up_scale_factor=0.85
#Do we need to disable QoS to get new QoS bandwidth limits
#Maybe not since traffic is from router
disable_qos_to_test=0
#Average download and upload speeds over this many
# consecutive speedtest runs
num_spd_tests=3
#Pause between successive speedtest runs (if num_spd_tests > 1)
pause_between_test=0
#If so, pause for how long (will be used with sleep command)
pause_this_long=1m
#spdMerlin command
spdMer_command="/jffs/scripts/spdmerlin generate"
#spdMer_command="echo DEBUG: spdMerlin executes now"
#Location of upload stats
upload_stats="/jffs/addons/spdmerlin.d/csv/Uploaddaily_WAN.htm"
#Location of download stats
download_stats="/jffs/addons/spdmerlin.d/csv/Downloaddaily_WAN.htm"
#Do you wanna to know what is going on if you manually run this script
show_me=1
######################################################################
#Disable QOS to find upload/download speeds
if (( $disable_qos_to_test )); then
(( $show_me )) && echo "Disabling QoS while performing speedtests ..."
nvram set qos_enable=0
nvram commit
service restart_qos 1> /dev/null
service restart_firewall 1> /dev/null
fi
#Calculate average download and upload speeds using spdMerlin
sum_down=0; sum_up=0; x=1
while [ $x -le $num_spd_tests ]
do
(( $show_me )) && echo -e "\nRunning spdMerlin test #$x of $num_spd_tests ..."
${spdMer_command} &> /dev/null
Mbps_down=$(tail -n1 $download_stats | awk -F ',' '{print $NF}')
Mbps_up=$(tail -n1 $upload_stats | awk -F ',' '{print $NF}')
sum_down=$(echo $sum_down+$Mbps_down | bc)
sum_up=$(echo $sum_up+$Mbps_up | bc)
if (( $show_me )); then
echo "===== SpeedTest: $x ====="
echo Download Speed: $Mbps_down Mbps
echo Upload Speed: $Mbps_up Mbps
fi
x=$(( $x + 1 ))
(( $pause_between_test )) && (( $x <= $num_spd_tests )) && echo "Sleeping for $pause_this_long ..." && sleep $pause_this_long
done
#Calculate the average values
Mbps_down=$(echo "scale=3; $sum_down/$num_spd_tests" | bc)
Mbps_up=$(echo "scale=3; $sum_up/$num_spd_tests" | bc)
if (( $show_me )) && (( $num_spd_tests > 1 )); then
echo -e "\n===== Averages: ====="
echo Download Speed: $Mbps_down Mbps
echo Upload Speed: $Mbps_up Mbps
fi
#Make sure download and uploads speeds are within defined user-defined limits above
if (( `echo "$Mbps_down < $download_lower_limit" | bc` )); then
logger " -----> Speedtest avg download speed ($Mbps_down Mbps) was less than lower limit ($download_lower_limit Mbps)"
(( $show_me )) && echo "Speedtest avg download speed ($Mbps_down Mbps) was less than lower limit ($download_lower_limit Mbps)"
Mbps_down=$download_lower_limit
elif (( `echo "$Mbps_down > $download_upper_limit" | bc` )); then
logger " -----> Speedtest avg download speed ($Mbps_down Mbps) was greater than upper limit ($download_upper_limit Mbps)"
(( $show_me )) && echo "Speedtest avg download speed ($Mbps_down Mbps) was greater than upper limit ($download_upper_limit Mbps)"
Mbps_down=$download_upper_limit
fi
if (( `echo "$Mbps_up < $upload_lower_limit" | bc` )); then
logger " -----> Speedtest avg upload speed ($Mbps_up Mbps) was less than lower limit ($upload_lower_limit Mbps)"
(( $show_me )) && echo "Speedtest avg upload speed ($Mbps_up Mbps) was less than lower limit ($upload_lower_limit Mbps)"
Mbps_up=$upload_lower_limit
elif (( `echo "$Mbps_up > $upload_upper_limit" | bc` )); then
logger " -----> Speedtest avg upload speed ($Mbps_up Mbps) was greater than upper limit ($upload_upper_limit Mbps)"
(( $show_me )) && echo "Speedtest avg upload speed ($Mbps_up Mbps) was greater than upper limit ($upload_upper_limit Mbps)"
Mbps_up=$upload_upper_limit
fi
#Convert to Kbps
#Could simplify this but want to know scaled Mbps so that it can be reported
Mbps_down=$(echo $Mbps_down*$down_scale_factor | bc)
Mbps_up=$(echo $Mbps_up*$up_scale_factor | bc)
Kbps_down=$(echo $Mbps_down*1024 | bc)
Kbps_up=$(echo $Mbps_up*1024 | bc)
#Set Download Limit
logger " -----> Setting QoS Download Speed to $Mbps_down Mbps ..."
(( $show_me )) && echo -e "\nAfter scaling by $down_scale_factor, setting QoS Download Speed to $Mbps_down Mbps ..."
nvram set qos_ibw=$Kbps_down
#Set Upload Limit
logger " -----> Setting QoS Upload Speed to $Mbps_up Mbps ..."
(( $show_me )) && echo "After scaling by $up_scale_factor, setting QoS Upload Speed to $Mbps_up Mbps ..."
nvram set qos_obw=$Kbps_up
#Re-Enable QoS if it was disabled to perform speedtest
if (( $disable_qos_to_test )); then
(( $show_me )) && echo "Re-enabling QoS now that speedtest are done ..."
nvram set qos_enable=1
fi
nvram commit
service restart_qos 1> /dev/null
service restart_firewall 1> /dev/null
(( $show_me )) && echo "Done."
exit 0;
I'll give it a try! Sounds cool!I hope this helps somebody ... works ok for me. Again, I am not very proficient at coding, just needed something that works for me.
Code:#!/opt/bin/bash ###################################################################### # SET-BW-SPEEDS # Set QoS upload/download speeds using Ookla speedtests and spdMerlin # Requires bash, bc, and spdMerlin ###################################################################### #Make sure speeds (before scaling) are within these boundaries # Mainly just to prevent bandwidth from being set too low # (or too high)... not worried about upper limit but it is there # for the sake of completeness download_lower_limit=10 #Mbps download_upper_limit=50 #Mbps upload_lower_limit=1.0 #Mbps upload_upper_limit=50 #Mbps #Scale average values by this factor #Adjust to optimize bufferbloat and quality grade at DSLreports.com down_scale_factor=0.85 up_scale_factor=0.85 #Do we need to disable QoS to get new QoS bandwidth limits #Maybe not since traffic is from router disable_qos_to_test=0 #Average download and upload speeds over this many # consecutive speedtest runs num_spd_tests=3 #Pause between successive speedtest runs (if num_spd_tests > 1) pause_between_test=0 #If so, pause for how long (will be used with sleep command) pause_this_long=1m #spdMerlin command spdMer_command="/jffs/scripts/spdmerlin generate" #spdMer_command="echo DEBUG: spdMerlin executes now" #Location of upload stats upload_stats="/jffs/addons/spdmerlin.d/csv/Uploaddaily_WAN.htm" #Location of download stats download_stats="/jffs/addons/spdmerlin.d/csv/Downloaddaily_WAN.htm" #Do you wanna to know what is going on if you manually run this script show_me=1 ###################################################################### #Disable QOS to find upload/download speeds if (( $disable_qos_to_test )); then (( $show_me )) && echo "Disabling QoS while performing speedtests ..." nvram set qos_enable=0 nvram commit service restart_qos 1> /dev/null service restart_firewall 1> /dev/null fi #Calculate average download and upload speeds using spdMerlin sum_down=0; sum_up=0; x=1 while [ $x -le $num_spd_tests ] do (( $show_me )) && echo -e "\nRunning spdMerlin test #$x of $num_spd_tests ..." ${spdMer_command} &> /dev/null Mbps_down=$(tail -n1 $download_stats | awk -F ',' '{print $NF}') Mbps_up=$(tail -n1 $upload_stats | awk -F ',' '{print $NF}') sum_down=$(echo $sum_down+$Mbps_down | bc) sum_up=$(echo $sum_up+$Mbps_up | bc) if (( $show_me )); then echo "===== SpeedTest: $x =====" echo Download Speed: $Mbps_down Mbps echo Upload Speed: $Mbps_up Mbps fi x=$(( $x + 1 )) (( $pause_between_test )) && (( $x <= $num_spd_tests )) && echo "Sleeping for $pause_this_long ..." && sleep $pause_this_long done #Calculate the average values Mbps_down=$(echo "scale=3; $sum_down/$num_spd_tests" | bc) Mbps_up=$(echo "scale=3; $sum_up/$num_spd_tests" | bc) if (( $show_me )) && (( $num_spd_tests > 1 )); then echo -e "\n===== Averages: =====" echo Download Speed: $Mbps_down Mbps echo Upload Speed: $Mbps_up Mbps fi #Make sure download and uploads speeds are within defined user-defined limits above if (( `echo "$Mbps_down < $download_lower_limit" | bc` )); then logger " -----> Speedtest avg download speed ($Mbps_down Mbps) was less than lower limit ($download_lower_limit Mbps)" (( $show_me )) && echo "Speedtest avg download speed ($Mbps_down Mbps) was less than lower limit ($download_lower_limit Mbps)" Mbps_down=$download_lower_limit elif (( `echo "$Mbps_down > $download_upper_limit" | bc` )); then logger " -----> Speedtest avg download speed ($Mbps_down Mbps) was greater than upper limit ($download_upper_limit Mbps)" (( $show_me )) && echo "Speedtest avg download speed ($Mbps_down Mbps) was greater than upper limit ($download_upper_limit Mbps)" Mbps_down=$download_upper_limit fi if (( `echo "$Mbps_up < $upload_lower_limit" | bc` )); then logger " -----> Speedtest avg upload speed ($Mbps_up Mbps) was less than lower limit ($upload_lower_limit Mbps)" (( $show_me )) && echo "Speedtest avg upload speed ($Mbps_up Mbps) was less than lower limit ($upload_lower_limit Mbps)" Mbps_up=$upload_lower_limit elif (( `echo "$Mbps_up > $upload_upper_limit" | bc` )); then logger " -----> Speedtest avg upload speed ($Mbps_up Mbps) was greater than upper limit ($upload_upper_limit Mbps)" (( $show_me )) && echo "Speedtest avg upload speed ($Mbps_up Mbps) was greater than upper limit ($upload_upper_limit Mbps)" Mbps_up=$upload_upper_limit fi #Convert to Kbps #Could simplify this but want to know scaled Mbps so that it can be reported Mbps_down=$(echo $Mbps_down*$down_scale_factor | bc) Mbps_up=$(echo $Mbps_up*$up_scale_factor | bc) Kbps_down=$(echo $Mbps_down*1024 | bc) Kbps_up=$(echo $Mbps_up*1024 | bc) #Set Download Limit logger " -----> Setting QoS Download Speed to $Mbps_down Mbps ..." (( $show_me )) && echo -e "\nAfter scaling by $down_scale_factor, setting QoS Download Speed to $Mbps_down Mbps ..." nvram set qos_ibw=$Kbps_down #Set Upload Limit logger " -----> Setting QoS Upload Speed to $Mbps_up Mbps ..." (( $show_me )) && echo "After scaling by $up_scale_factor, setting QoS Upload Speed to $Mbps_up Mbps ..." nvram set qos_obw=$Kbps_up #Re-Enable QoS if it was disabled to perform speedtest if (( $disable_qos_to_test )); then (( $show_me )) && echo "Re-enabling QoS now that speedtest are done ..." nvram set qos_enable=1 fi nvram commit service restart_qos 1> /dev/null service restart_firewall 1> /dev/null (( $show_me )) && echo "Done." exit 0;
Not sure, but maybe edit /jffs/addons/spdmerlin.d/config with your PREFERREDSERVER and make sure USEPREFERRED=trueI'll give it a try! Sounds cool!
I just want to edit something - how can I call spdMerlin option 2 (use preferred server)? Because I need to force a specifically server where I know I can get my real speeds
I made some tests and I think it affects ....Using same preferred server:
Running script with QoS enabled:
===== Averages: =====
Download Speed: 17.393 Mbps
Upload Speed: .650 Mbps
Running script with QoS disabled:
===== Averages: =====
Download Speed: 18.530 Mbps
Upload Speed: 3.746 Mbps
So, for me at least, having QoS enabled does appear to affect the Speedtest results.
What are your internet speeds and can you post pics of your setup using bandwidth limiter? ThanksSomething odd going on with the script.
The script has been working ok for ages.
With DSLreports i can tweak it to get A+ A and A+ but recently its been simply A A A.
Now with online games this has made a difference...a very noticeable one too.
After tweaking the DL and UL no joy.
But switching to bandwidth limiter BINGO.
Back to A+ A A+ plus the latency to the nearest server is 20ms lower than under the script.
Gameplay is also noticeably better.
What are your internet speeds and can you post pics of your setup using bandwidth limiter? Thanks
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!