229 lines
4.1 KiB
HTML
229 lines
4.1 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Before We Start</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
|
|
"><LINK
|
|
REL="HOME"
|
|
TITLE="Bandwidth Limiting HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Introduction"
|
|
HREF="intro.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="Installing and Configuring Necessary Software"
|
|
HREF="install.html"></HEAD
|
|
><BODY
|
|
CLASS="SECT1"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>Bandwidth Limiting HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="intro.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="install.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="SECT1"
|
|
><H1
|
|
CLASS="SECT1"
|
|
><A
|
|
NAME="PREP"
|
|
>2. Before We Start</A
|
|
></H1
|
|
><P
|
|
>Let's imagine the following situation:</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>We have 115,2 kbits/s ppp (modem) internet link (115,2/10
|
|
= 11,5 kbytes/s). Note: with eth connections
|
|
(network card) we would divide 115,2 by 8; with ppp we divide by 10, because
|
|
of start/stop bits (8 + 1 + 1 = 10).</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>We have some LAN stations and their users are doing bulk downloads
|
|
all the time.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>We want web pages to open fast, no matter how
|
|
many dowloads are happening.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Our internet interface is <B
|
|
CLASS="COMMAND"
|
|
>ppp0</B
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Our LAN interface is <B
|
|
CLASS="COMMAND"
|
|
>eth0</B
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Our network is 192.168.1.0/24</P
|
|
></LI
|
|
></UL
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN60"
|
|
>2.1. What do we need</A
|
|
></H2
|
|
><P
|
|
>Believe it or not, shaping the incoming traffic is an easy
|
|
task and you don't have to read tons of books about routing or queuing algorithms.</P
|
|
><P
|
|
>To make it work, we need at least Squid proxy; if we want to fine tune
|
|
it, we will have to get familiar with ipchains or iptables and CBQ.</P
|
|
><P
|
|
>To test our efforts, we can install IPTraf.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="AEN65"
|
|
>2.2. How does it work?</A
|
|
></H2
|
|
><P
|
|
>Squid is probably the most advanced HTTP proxy server available for Linux.
|
|
It can help us save bandwidth in two ways:</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>The first is a main characteristic of proxy servers -- they keep downloaded
|
|
web pages, pictures, and other objects in memory or on a disk. So, if two people are
|
|
requesting the same web page, it isn't downloaded from the internet,
|
|
but from the local proxy. </P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Apart from normal caching, Squid has a special feature called delay
|
|
pools. Thanks to delay pools, it is possible to limit internet traffic in a
|
|
reasonable way, depending on so-called 'magic words', existing in any given
|
|
URL. For example, a magic word could be '.mp3', '.exe' or '.avi', etc.
|
|
Any distinct part of a URL (such as .avi) can be defined as a magic word.</P
|
|
></LI
|
|
></UL
|
|
><P
|
|
>With that, we can tell the Squid to download these kinds of files at a
|
|
specified speed (in our example, it will be about 5 kbytes/s). If our
|
|
LAN users download files at the same time, they will be downloaded
|
|
at about 5 kbytes/s altogether, leaving remaining bandwidth for web pages,
|
|
e-mail, news, irc, etc.</P
|
|
><P
|
|
>Of course, the Internet is not only used for downloading files via web
|
|
pages (http or ftp). Later on, we will deal with limiting bandwidth for Napster,
|
|
Realaudio, and other possibilities.</P
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="intro.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="install.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Introduction</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
> </TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>Installing and Configuring Necessary Software</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |