Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linux traffic shaping improve ping with Youtube

#1
Most DSL lines get unstable when you use more than a certain percentage of your total bandwidth. That is why I wrote this very simple traffic shaping script. It will slow down all TCP packets from your PC to the 45/115kbit limit, so you might want to disable it after playing.

Code:
tc qdisc add dev eth0 root handle 1: htb default 30

tc class add dev eth0 parent 1: classid 1:1 htb rate 1gbit burst 15k
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 45kbit ceil 115kbit burst 15k
tc qdisc add dev eth0 parent 1:20 handle 20: sfq perturb 10

tc filter add dev eth0 protocol ip u32 match ip protocol 6 0xff flowid 1:20


To remove the traffic shaping:


Code:
tc qdisc del root dev eth0


Don't trust the numbers, use mtr instead to fine-tune how much downloads affect your line.

Code:
mtr cctv.cn

If you don't know mtr: Press "d" twice and it will show you a dot or a number for a series of pings on each column, repeated each second. The first row is your ISP, the last row is in China. When the line is having issues, you will see vertical stripes of numbers (or even question marks) in the picture.  A question mark means packet loss and numbers are just delayed. The scale is shown at the bottom, e.g. a "3" could mean 400ms and a dot could mean 10ms. If you have horizontal stripes with question marks it means that the target is receiving too many ping requests and is filtering your packets. Vertical stripes however can only be because of your line.


Before when watching Youtube 1080p

[Image: sxU75vf.jpg]

After

[Image: 2OwnjGw.png]


Unfortunately you cannot enable this traffic shaping on your router directly, unless you use OpenWRT or something like that. So it will still mess up your ping if your family watches videos over your line.
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
  How does Xonotic stretch to all my screens on Linux? Espionage724 1 2,699 10-18-2015, 12:04 AM
Last Post: BuddyFriendGuy

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-