LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Request for a simple net script edit (https://www.linuxquestions.org/questions/linux-networking-3/request-for-a-simple-net-script-edit-329988/)

<Ol>Origy 06-03-2005 12:51 PM

Request for a simple net script edit
 
I'm having some trouble with my internet connection. I have a linux PC box I use as a router/gateway. The thing is that whenever someone on my subnet uses one of those P2P programs, the pings increase dramatically making any PC games almost unplayable over the network at the same time. Now I found a way to decrease the pings by adding I script I found on a website to my /etc/rc.d/ firewall.
Here is what I use:

Code:

#!/bin/bash
#Example config for an adsl link with 1024Kbit downstream and 256Kbit upstream

iptables -t mangle -A OUTPUT -m length --length 0:500 -j MARK --set-mark 3
iptables -t mangle -A OUTPUT -m length --length 500:1500 -j MARK --set-mark 4

#We assume masqueraded machines on eth0 should also have their upload tuned

iptables -t mangle -A PREROUTING -i eth0 -m length --length 0:500 -j MARK --set-mark 3
iptables -t mangle -A PREROUTING -i eth0 -m length --length 500:1500 -j MARK --set-mark 4

tc qdisc add dev ppp0 root handle 10: cbq bandwidth 10Mbit avpkt 1000 mpu 64

tc class add dev ppp0 parent 10:0 classid 10:1 cbq bandwidth 10Mbit \
    rate 51Kbit allot 1514 prio 1 maxburst 10 avpkt 100 isolated
tc class add dev ppp0 parent 10:0 classid 10:2 cbq bandwidth 10Mbit \
    rate 180Kbit allot 1514 prio 8 maxburst 2 avpkt 1500 bounded

tc filter add dev ppp0 parent 10:0 protocol ip handle 3 fw flowid 10:1
tc filter add dev ppp0 parent 10:0 protocol ip handle 4 fw flowid 10:2

The normal ping to one of our local ISP servers is 20 ms. Before I integrated this code into my firewall, the pings used to reach up to 1600 ms. Now they reach to about 500 ms which is still too high. Now I'd like to know if there is a way to reduce the pings even further. The thing I understood from that script is that it sorts the packets into 2 groups depending on their size and sends out the little ones first. The bigger ones are sent last. Now I would like to ask someone if he can edit this script since I do not quite understand what this script does and I wouldn't want to mess with it myself.

Here's what I came up with:
Would it be possible to edit the script and let the firewall sort the packets into 3 different groups (instead of 2) depending on their size. The little ones up to 150 bytes (that most games use) would have the highest priority and be sent before any other. The second group should have packets in size from 150 to 500 bytes which would get sent before the 3rd group but after the 1st one. And finally the third group with all the packets beyond 500 bytes in size being sent last.

Would this idea of mine make any difference in pings?
If this doesn't work, what else should I do to decrease the pings (other than purchase a faster connection or block P2P traffic)?


Thank you for your time.


All times are GMT -5. The time now is 10:20 PM.