2

I am using an OpenSSH server for a client app that uses the traffic forwarding, SSH tunnelling and some users are consuming an extraordinary amount of bandwidth. Is there a way to shape the traffic on SSH port output or SSH/TCP/IP Session and make sure that the fair amount of bandwidth gets distributed for each connected user?

I have come across of this site and modified the script, but I was wondering if there is a better solution to resolve the occurred problem.

tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 4096kbps
tc class add dev eth0 parent 1:1 classid 1:5 htb rate 2048kbps ceil 2208kbps prio 1
tc filter add dev eth0 parent 1:0 prio 1 protocol ip handle 5 fw flowid 1:5

iptables -A OUTPUT -t mangle -p tcp --sport 22 -j MARK --set-mark 5
1
  • @Braiam yes, but i wasn't quite sure if the wondershaper would fit the purpose on the out going traffic! wondershaper clear eth0 && wondershaper eth0 4096 1024
    – Mantichora
    Apr 29, 2014 at 14:47

1 Answer 1

1

Instead of burring your head in the complicated tc I recommend you using wondershaper. It configures the optimal options both outgoing and incoming traffic by default. The syntax is simple enough. Just verify the device you want to configure such eth0, calculate the raw uplink and downlink bits. Normally network providers supply bits as measure, like "1 Mbps" or "512Kbps" so it's simple. In case of doubt check with your ISP. For each system just install wondershaper:

sudo apt-get install wondershaper

Run wondershaper as root and determine how much broadband will be given to each system:

sudo wonderwhaper eth0 1000 500

In the above example I gave limits to eth0 device of 1,000 kilo bits downstream and 500 kilo bits upstream. Is recommended to leave some space of breath between the maximum raw speed and the limited.

4
  • Thanks for the reply. I've tried this before as you see in my last reply with not much of luck. Just on the configuration side, shouldn't the value of upload set to higher rather than download on the SSH reverse situation as the users are tunnelling the traffic through the server?
    – Mantichora
    Apr 29, 2014 at 15:16
  • @Iman no, it should reflect your real up/downlink speed. Those numbers are meant to be calculated based on them, not out of thin air ;).
    – Braiam
    Apr 29, 2014 at 15:32
  • aggregate of 100Mbit/s of traffic per VPS is given and I believe it is a reasonable limit but it really does depend on a lot of factors. However, would wonderwhaper be able to help assuring the limit of 2Mbps download rate and 512Kbps upload for each connected client to the VPS server? i.e wondershaper eth0 2048 512
    – Mantichora
    Apr 29, 2014 at 15:48
  • @Iman of course. It may degrade somehow the clients speed, but that's expected.
    – Braiam
    Apr 29, 2014 at 16:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .