Jump to content

Tips&Tricks Internet connection tuning


aru
 Share

Recommended Posts

 

tross04401

Moderator

Joined: 16 Apr 2002

Posts: 175

Location: Maine (US)

 

Post Posted: Sat May 04, 2002 7:24 pm Post subject: Internet connection tuning

_________________________________________________________________

 

 

Here is a script I use on my computer that is modified from the QoS_ConnectionTuningHOWTO on the coverdisk of the February, 2002 Linux Format. QoS is quality of service. What the script is doing is enhancing connection speed and response time with QoS, iptables and iproute2. You will need the 2.4.16 kernel or above to use this.

 

What it does is break your upstream connection into two classes.

 

The first class is for interactive connections. It has less bandwidth, but a higher priority. This is for use with small packets ( tcp ack, irc, ssh, telnet, http requests, etc. )

 

The second class is for large packets ( for example, when someone is grabbing a file from my ftp server, http responses, email with large attachments, peer to peer transfers from my computer, etc. )

 

Since it's being done by the size of the packets, you don't need to modify things every time you add a different port, ip, or tcp type.

 

This script works fine for me. You might want to adjust it to fit your connection speed. It should be obvious what you'll need to fiddle with - just look for the items with the Kbit suffix and the 0:500 & 500:1500

 

Just copy the script, modify it as you desire, make it executable and run it as root every time you bring up your network.

 

Code:

#!/bin/bash

#

# Script for my adsl connection.  Modified from an article in the Feb 2002 Linux Format



ROOT_UID=0  # Only users with $UID 0 have root privileges.

E_NOTROOT=67 # Non-root exit error.



if [ "$UID" -ne "$ROOT_UID" ]

then

  echo "You must be root to run this script."

  exit $E_NOTROOT

fi



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



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 127Kbit 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

 

 

 

Editor's note: This thread was originally posted at the old MUB (Mandrake User Board at club-nihil). This post is the result of a 99% automatic backup, so due to its nature some text may be lost (improbable but possible).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...