Changeset 3a3cfab in freewrt for docs


Ignore:
Timestamp:
Jun 30, 2007, 3:09:21 PM (18 years ago)
Author:
Phil Sutter <n0-1@…>
Branches:
freewrt_1_0, freewrt_2_0
Children:
69879d0
Parents:
8e6a19f
Message:

add some documentation of fwrtc, the FreeWRT Traffic Control script

git-svn-id: svn://www.freewrt.org/branches/freewrt_1_0@3046 afb5a338-a214-0410-bd46-81f09a774fd1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/handbook/user/handbook.tex

    r8e6a19f r3a3cfab  
    12351235Same semantics as above.
    12361236
     1237
     1238\section{Traffic Control}
     1239
     1240To aid in setting up Quality of Service and Traffic Shaping, FreeWRT provides a
     1241configurable script via the \app{fwrtc} package. Though this package will allow
     1242you to choose between different implementations of Queueing Disciplines, for
     1243now there exists only a single implementation using HTB.
     1244
     1245\subsection{Concept}
     1246
     1247In general, \app{fwrtc} allows classifying of network traffic into three classes:
     1248\begin{description}
     1249        \item[REAL] high priority, mid bandwidth \\
     1250                use this for low delay applications like \app{SSH}, \app{VoIP}
     1251                or \app{DNS}
     1252        \item[BULK] mid priority, high bandwidth \\
     1253                this is a generic class for everything that doesn't fit above
     1254                or below
     1255        \item[P2P] low priority, low bandwidth \\
     1256                use this class for all unwanted traffic disturbing normal use
     1257                of the internet connection (\app{P2P} and other parasites)
     1258\end{description}
     1259
     1260\paragraph{Note} that fwrtc does not actually classify the traffic, it just
     1261provides the classes above and allows comfortable configuration of the
     1262necessary values. For classifying traffic, use \app{iptables} (see below for
     1263more details).
     1264
     1265\subsection{Installation}
     1266
     1267This is done just like with any other FreeWRT package, so using the ADK to
     1268integrate it into the firmware image right from the start or by installing it
     1269afterwards using \app{ipkg}.
     1270
     1271\subsection{Configuration}
     1272
     1273\app{fwrtc} basically exists of two files:
     1274\begin{itemize}
     1275        \item the script itself \file{/etc/hotplug.d/net/10-fwrtc}
     1276        \item a configuration file \file{/etc/fwrtc.conf}
     1277\end{itemize}
     1278It should not be necessary to touch the hotplug script, so adjusting the
     1279configuration values should be enough to complete the first part of the setup
     1280process.
     1281
     1282The second part consists of defining \app{iptables} rules for classifying
     1283traffic. \app{fwrtc} provides three \app{tc}-filters (one for each class),
     1284matching different firewall marks (see the \code{MARK} target of
     1285\app{iptables}).
     1286
     1287See the example below to gather some inspiration on how to actually
     1288implementing the rules:
     1289
     1290\begin{Verbatim}[label=sample set of iptables rules for fwrtc]
     1291iptables -t mangle -A POSTROUTING -o eth0 -j tc
     1292
     1293### match ip tos Minimum-Delay
     1294iptables -t mangle -A tc -m tos --tos 0x10 -j MARK --set-mark 0x1
     1295iptables -t mangle -A tc -m tos --tos 0x10 -j RETURN
     1296
     1297## fish out tcp syn, syn-ack and ack packets (no piggyback!)
     1298iptables -t mangle -A tc -p tcp -m length --length 44:84 \
     1299        --tcp-flags SYN,FIN,RST SYN -j MARK --set-mark 0x1
     1300iptables -t mangle -A tc -p tcp -m length --length 44:84 \
     1301        --tcp-flags SYN,FIN,RST SYN -j RETURN
     1302iptables -t mangle -A tc -p tcp -m length --length 44:84 \
     1303        --tcp-flags SYN,ACK,FIN,RST ACK -j MARK --set-mark 0x1
     1304iptables -t mangle -A tc -p tcp -m length --length 44:84 \
     1305        --tcp-flags SYN,ACK,FIN,RST ACK -j RETURN
     1306
     1307### prioritize icmp packets
     1308iptables -t mangle -A tc -p icmp -j MARK --set-mark 0x1
     1309iptables -t mangle -A tc -p icmp -j RETURN
     1310
     1311### dns traffic
     1312iptables -t mangle -A tc -p tcp --dport 53 -j MARK --set-mark 0x1
     1313iptables -t mangle -A tc -p tcp --dport 53 -j RETURN
     1314iptables -t mangle -A tc -p udp --dport 53 -j MARK --set-mark 0x1
     1315iptables -t mangle -A tc -p udp --dport 53 -j RETURN
     1316
     1317### games
     1318iptables -t mangle -A tc -m layer7 --l7proto quake-halflife -j MARK --set-mark 0x1
     1319iptables -t mangle -A tc -m layer7 --l7proto quake-halflife -j RETURN
     1320iptables -t mangle -A tc -m layer7 --l7proto battlefield1942 -j MARK --set-mark 0x1
     1321iptables -t mangle -A tc -m layer7 --l7proto battlefield1942 -j RETURN
     1322iptables -t mangle -A tc -m layer7 --l7proto battlefield2 -j MARK --set-mark 0x1
     1323iptables -t mangle -A tc -m layer7 --l7proto battlefield2 -j RETURN
     1324
     1325### voip
     1326iptables -t mangle -A tc -m layer7 --l7proto sip -j MARK --set-mark 0x1
     1327iptables -t mangle -A tc -m layer7 --l7proto sip -j RETURN
     1328iptables -t mangle -A tc -m layer7 --l7proto rtp -j MARK --set-mark 0x1
     1329iptables -t mangle -A tc -m layer7 --l7proto rtp -j RETURN
     1330iptables -t mangle -A tc -m layer7 --l7proto skypetoskype -j MARK --set-mark 0x1
     1331iptables -t mangle -A tc -m layer7 --l7proto skypetoskype -j RETURN
     1332
     1333### crappy p2p traffic
     1334iptables -t mangle -A tc -m layer7 --l7proto bittorrent -j MARK --set-mark 0x3
     1335iptables -t mangle -A tc -m layer7 --l7proto bittorrent -j RETURN
     1336iptables -t mangle -A tc -m layer7 --l7proto edonkey -j MARK --set-mark 0x3
     1337iptables -t mangle -A tc -m layer7 --l7proto edonkey -j RETURN
     1338iptables -t mangle -A tc -m layer7 --l7proto fasttrack -j MARK --set-mark 0x3
     1339iptables -t mangle -A tc -m layer7 --l7proto fasttrack -j RETURN
     1340iptables -t mangle -A tc -m layer7 --l7proto gnutella -j MARK --set-mark 0x3
     1341iptables -t mangle -A tc -m layer7 --l7proto gnutella -j RETURN
     1342iptables -t mangle -A tc -m layer7 --l7proto napster -j MARK --set-mark 0x3
     1343iptables -t mangle -A tc -m layer7 --l7proto napster -j RETURN
     1344\end{Verbatim}
     1345
    12371346\section{FWCF - FreeWRT Configuration Filesystem}
    12381347
Note: See TracChangeset for help on using the changeset viewer.