LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   P2P traffic shaping on kernel 3.6.4 (https://www.linuxquestions.org/questions/linux-networking-3/p2p-traffic-shaping-on-kernel-3-6-4-a-4175450024/)

fandar 02-13-2013 01:52 PM

P2P traffic shaping on kernel 3.6.4
 
Hello, what can be used for P2P traffic shaping on kernel 3.6.4? Something like IPP2P? My aim is to to give high priority to ICMP, SSH, VOIP, etc. then to HTTP and the lowest priority to P2P networks and torrents. Thank you

jnihil 02-13-2013 09:44 PM

You could use tc (traffic control):

http://www.tldp.org/HOWTO/html_singl...Control-HOWTO/

I've only used tc with the Vyatta software router (based on Linux) to simulate WANs with high-latency and packet losses for UDP packets, but tc will allow you to shape/police the traffic level based on the policy you define for different classifications of network traffic. The learning curve was a little steep, but it's certainly an option.

fandar 02-14-2013 04:05 AM

Yes, I know but the question is what to use to determine torrents and other P2P networks because It seems that ipp2p or layer-7 doesnt work with kernel 3.6

jnihil 02-14-2013 08:58 AM

Yeah, it's hard when people switch port numbers and encrypt their torrent payoads.
One way to go about it is prioritize the non-torrent traffic, then put the torrent and 'other' trivial traffic in a low queue.

fandar 02-15-2013 03:57 AM

OK, one more question. I am trying to do the traffic shaping on a router with wwan (3G modem) and wlan as local network. Can you refer me to some good example howto do it? Because the connection speed on the wwan network is variable (from few KB/s to MB/s) so howto write that rules? I have been searching on google and tried several examples but nothing seems to be working good here. I need to setup priority for ICMP packets so the ping to 8.8.8.8 remain still the same when pinging from the router. (I am using ping to check internet connection and set services on the router accordingly). But each time when the network signal is low and I am downloading some file via http/ftp the ping is going from 200ms to 4000ms. The next step will be to set to all of the P2P and unknown services (ports) the lowest priority. Any idea howto correctly shape the wlan traffic in order to keep the ping response time at least under 500ms? The internet connection speed is different every time. Thank You in advance.

jnihil 02-15-2013 12:07 PM

And what router do you use?
Does it have configurable queues?

fandar 02-16-2013 05:04 AM

Hello, its a box with debian Linux

jnihil 02-16-2013 09:32 PM

I'm going to point you to the Linux Advanced Routing & Traffic Control HOWTO http://lartc.org/lartc.html#LARTC.QDISC because everything about tc/iptables in explained there.
I also found what looks like a great webUI frontend for tc/iptables called mastershaper: http://www.mastershaper.org/index.php/Main_Page
If you want to get dirty with the cli, The Wonder Shaper http://lartc.org/wondershaper/ has a great script and README detailing what can be done.

I suppose your problem with classification of bittorrent remains, but in my bt client setup (deluged) I have my source/destination layer-4 port ranges defined, so explicit packet classification is possible in the egress direction. Not sure if you can do that with your bt client, but otherwise you can define a high priority class based queue for traffic which you can classify, and a low priority queue for everything else.

fandar 02-18-2013 02:33 AM

Hello, I have read the Linux Advanced Routing & Traffic Control HOWTO and also checked the wonder traffic shaping script but in both I need to know the connection speed (upload and download) as I wrote its a 3g modem and the connection speed is very variable. Is there some way howto measure the connection speed in realtime with a small amount of data send/receive? Or a better way howto do this? Thank You

jnihil 02-18-2013 03:13 AM

It'll be hard measuring the fluctuating bandwidth of a WWAN connection in realtime.
How about using tc's prio qdisc which doesn't use the underlying bandwidth for its dequeuing algorithm but uses traffic priority only?


All times are GMT -5. The time now is 03:15 PM.