SSHFS Bandwidth Rate Limit
Jump to navigation
Jump to search
This script will allow you to control the rate at which an SSHFS client uploads data to a remote server.
#!/bin/bash # Replace these variables with desired values DEV=eth0 DEV_MAX=1Gbit SSH_UPLOAD=5Mbit SERVER_IP=10.1.2.3/32 SERVER_PORT=22 tc qdisc del dev $DEV root tc qdisc add dev $DEV root handle 1: htb default 10 tc class add dev $DEV parent 1: classid 1:5 htb rate $DEV_MAX tc class add dev $DEV parent 1:5 classid 1:10 htb rate 128kbit ceil $DEV_MAX tc class add dev $DEV parent 1:5 classid 1:20 htb rate 128kbit ceil $SSH_UPLOAD tc qdisc add dev $DEV parent 1:10 handle 10: sfq tc qdisc add dev $DEV parent 1:20 handle 20: sfq tc filter add dev $DEV parent 1: protocol ip prio 5 u32 match ip dst $SERVER_IP match ip dport $SERVER_PORT 0xffff classid 1:20
I'm not yet an expert in tc
as of this writing, so more to come, maybe.