I have applied bandwidth control using TC and iptables using this tutorial on my Strongswan VPN server. The bandwidth control works fine ONLY if that specific client is already connected. For example: In my Strongswan VPN server, i am trying to limit bandwidth of server

The PROBLEM is bandwidth limit will only work if this client is connected and then i run the bandwidth script. Otherwise, If i run the script first, and then later the client connects , the bandwidth control doesn't work. Is this some kind of requirement that this script works for connected clients only ?

My script looks like this

ikev2=24 #eth0
echo tc qdisc del dev $main root >>tcrules
echo tc qdisc add dev $main root handle 1: htb >>tcrules
for i in {1..254}
echo iptables -I FORWARD -s 10.$ikev2.$ikev2.$i -j MARK --set-mark 1$i >> mark
echo iptables -I FORWARD -d 10.$ikev2.$ikev2.$i -j MARK --set-mark 1$i >> mark
echo tc class add dev eth0 parent 1:1 classid 1:1$i htb rate 1mbit ceil 1mbit >> tcrules
echo tc qdisc add dev eth0 parent 1:1$i sfq perturb 10 >> tcrules
echo tc filter add dev eth0 protocol ip parent 1: prio 1 handle 1$i fw flowid 1:1$i >> tcrules

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.