NameDateSize

..12-Mar-20154 KiB

.gitignore12-Mar-2015299

Android.mk12-Mar-201537

CleanSpec.mk12-Mar-20152.2 KiB

configure12-Mar-20153.8 KiB

COPYING12-Mar-201517.6 KiB

doc/12-Mar-20154 KiB

etc/12-Mar-20154 KiB

examples/12-Mar-20154 KiB

genl/12-Mar-20154 KiB

include/12-Mar-20154 KiB

ip/12-Mar-20154 KiB

lib/12-Mar-20154 KiB

Makefile12-Mar-20151.9 KiB

man/12-Mar-20154 KiB

misc/12-Mar-20154 KiB

netem/12-Mar-20154 KiB

tc/12-Mar-20154 KiB

testsuite/12-Mar-20154 KiB

1This is a set of utilities for Linux networking.
2
3Information:
4    http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
5
8
9Repository:
10    git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git
11
12How to compile this.
13--------------------
141. libdbm
15
16arpd needs to have the db4 development libraries. For Debian
17users this is the package with a name like libdb4.x-dev.
18DBM_INCLUDE points to the directory with db_185.h which
19is the include file used by arpd to get to the old format Berkeley
20database routines.  Often this is in the db-devel package.
21
222. make
23
24The makefile will automatically build a Config file which
25contains whether or not ATM is available, etc.
26
273. To make documentation, cd to doc/ directory , then
28   look at start of Makefile and set correct values for
29   PAGESIZE=a4		, ie: a4 , letter ...	(string)
30   PAGESPERPAGE=2	, ie: 1 , 2 ...		(numeric)
31   and make there. It assumes, that latex, dvips and psnup
33
344. This package includes matching sanitized kernel headers because
35   the build environment may not have up to date versions. See Makefile
36   if you have special requirements and need to point at different
37   kernel include files.
38
39Stephen Hemminger
40shemminger@linux-foundation.org
41
42Alexey Kuznetsov
43kuznet@ms2.inr.ac.ru
44

1
2Here are a few quick points about DECnet support...
3
4 o iproute2 is the tool of choice for configuring the DECnet support for
5   Linux. For many features, it is the only tool which can be used to
6   configure them.
7
8 o No name resolution is available as yet, all addresses must be
9   entered numerically.
10
11 o Remember to set the hardware address of the interface using:
12
16
17   if your Ethernet card won't listen to more than one unicast
18   mac address at once. If the Linux DECnet stack doesn't talk to
19   any other DECnet nodes, then check this with tcpdump and if its
20   a problem, change the mac address (but do this _before_ starting
21   any other network protocol on the interface)
22
24   interface, don't expect addresses which are not the same as the
25   kernels node address to work properly with 2.4 kernels. This should
26   be fine with 2.6 kernels as the routing code has been extensively
27   modified and improved.
28
29 o The DECnet support is currently self contained. It does not depend on
30   the libdnet library.
31
32Steve Whitehouse <steve@chygwyn.com>
33
34

1Iproute2 development is closely tied to Linux kernel networking
2development. Most new features require a kernel and a utility component.
3
4Please submit both to the Linux networking mailing list
5   <netdev@vger.kernel.org>
6
7The current source is in the git repository:
8    git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git
9
10The master branch contains the source corresponding to the current
11code in the mainline Linux kernel (ie follows Linus). The net-next
12branch is a temporary branch that tracks the code intended for the
13next release; it corresponds with networking development branch in
14the kernel.
15
16

1I. About the distribution tables
2
3The table used for "synthesizing" the distribution is essentially a scaled,
4translated, inverse to the cumulative distribution function.
5
6Here's how to think about it: Let F() be the cumulative distribution
7function for a probability distribution X.  We'll assume we've scaled
8things so that X has mean 0 and standard deviation 1, though that's not
9so important here.  Then:
10
11	F(x) = P(X <= x) = \int_{-inf}^x f
12
13where f is the probability density function.
14
15F is monotonically increasing, so has an inverse function G, with range
160 to 1.  Here, G(t) = the x such that P(X <= x) = t.  (In general, G may
17have singularities if X has point masses, i.e., points x such that
18P(X = x) > 0.)
19
20Now we create a tabular representation of G as follows:  Choose some table
21size N, and for the ith entry, put in G(i/N).  Let's call this table T.
22
23The claim now is, I can create a (discrete) random variable Y whose
24distribution has the same approximate "shape" as X, simply by letting
25Y = T(U), where U is a discrete uniform random variable with range 1 to N.
26To see this, it's enough to show that Y's cumulative distribution function,
27(let's call it H), is a discrete approximation to F.  But
28
29	H(x) = P(Y <= x)
30	     = (# of entries in T <= x) / N   -- as Y chosen uniformly from T
31	     = i/N, where i is the largest integer such that G(i/N) <= x
32	     = i/N, where i is the largest integer such that i/N <= F(x)
33	     		-- since G and F are inverse functions (and F is
34	     		   increasing)
35	     = floor(N*F(x))/N
36
37as desired.
38
39II. How to create distribution tables (in theory)
40
41How can we create this table in practice? In some cases, F may have a
42simple expression which allows evaluating its inverse directly.  The
43Pareto distribution is one example of this.  In other cases, and
44especially for matching an experimentally observed distribution, it's
45easiest simply to create a table for F and "invert" it.  Here, we give
46a concrete example, namely how the new "experimental" distribution was
47created.
48
491. Collect enough data points to characterize the distribution.  Here, I
50collected 25,000 "ping" roundtrip times to a "distant" point (time.nist.gov).
51That's far more data than is really necessary, but it was fairly painless to
52collect it, so...
53
542. Normalize the data so that it has mean 0 and standard deviation 1.
55
563. Determine the cumulative distribution.  The code I wrote creates a table
57covering the range -10 to +10, with granularity .00005.  Obviously, this
58is absurdly over-precise, but since it's a one-time only computation, I
59figured it hardly mattered.
60
614. Invert the table: for each table entry F(x) = y, make the y*TABLESIZE
62(here, 4096) entry be x*TABLEFACTOR (here, 8192).  This creates a table
63for the ("normalized") inverse of size TABLESIZE, covering its domain 0
64to 1 with granularity 1/TABLESIZE.  Note that even with the granularity
65used in creating the table for F, it's possible not all the entries in
66the table for G will be filled in.  So, make a pass through the
67inverse's table, filling in any missing entries by linear interpolation.
68
69III. How to create distribution tables (in practice)
70
71If you want to do all this yourself, I've provided several tools to help:
72
731. maketable does the steps 2-4 above, and then generates the appropriate
74header file.  So if you have your own time distribution, you can generate
76
77	maketable < time.values > header.h
78
792. As explained in the other README file, the somewhat sleazy way I have
80of generating correlated values needs correction.  You can generate your
81own correction tables by compiling makesigtable and makemutable with
82your header file.  Check the Makefile to see how this is done.
83
843. Warning: maketable, makesigtable and especially makemutable do
85enormous amounts of floating point arithmetic.  Don't try running
86these on an old 486.  (NIST Net itself will run fine on such a
87system, since in operation, it just needs to do a few simple integral
88calculations.  But getting there takes some work.)
89
904. The tables produced are all normalized for mean 0 and standard
91deviation 1.  How do you know what values to use for real?  Here, I've
92provided a simple "stats" utility.  Give it a series of floating point
93values, and it will return their mean (mu), standard deviation (sigma),
94and correlation coefficient (rho).  You can then plug these values
95directly into NIST Net.
96

1iproute2+tc*
2
3It's the first release of Linux traffic control engine.
4
5
6NOTES.
7* csz scheduler is inoperational at the moment, and probably
8  never will be repaired but replaced with h-pfq scheduler.
9* To use "fw" classifier you will need ipfwchains patch.
10* No manual available. Ask me, if you have problems (only try to guess
11  answer yourself at first 8)).
12
13
14Micro-manual how to start it the first time
15-------------------------------------------
16
17A. Attach CBQ to eth1:
18
19tc qdisc add dev eth1 root handle 1: cbq bandwidth 10Mbit allot 1514 cell 8 \
20avpkt 1000 mpu 64
21
23
24tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth 10Mbit rate 10Mbit \
25allot 1514 cell 8 weight 1Mbit prio 8 maxburst 20 avpkt 1000
26
28
29tc class add dev eth1 parent 1:1 classid 1:2 cbq bandwidth 10Mbit rate 1Mbit \
30allot 1514 cell 8 weight 100Kbit prio 3 maxburst 20 avpkt 1000 split 1:0 \
31defmap c0
32
34
35tc class add dev eth1 parent 1:1 classid 1:3 cbq bandwidth 10Mbit rate 8Mbit \
36allot 1514 cell 8 weight 800Kbit prio 7 maxburst 20 avpkt 1000 split 1:0 \
37defmap 3f
38
39etc. etc. etc. Well, it is enough to start 8) The rest can be guessed 8)
40Look also at more elaborated example, ready to start rsvpd,
41in rsvp/cbqinit.eth1.
42
43
44Terminology and advices about setting CBQ parameters may be found in Sally Floyd
45papers.
46
47
48Pairs X:Y are class handles, X:0 are qdisc handles.
49weight should be proportional to rate for leaf classes
50(I choosed it ten times less, but it is not necessary)
51
52defmap is bitmap of logical priorities served by this class.
53
54E. Another qdiscs are simpler. F.e. let's join TBF on class 1:2
55
56tc qdisc add dev eth1 parent 1:2 tbf rate 64Kbit buffer 5Kb/8 limit 10Kb
57
58F. Look at all that we created:
59
60tc qdisc ls dev eth1
61tc class ls dev eth1
62
63G. Install "route" classifier on root of cbq and map destination from realm
641 to class 1:2
65
66tc filter add dev eth1 parent 1:0 protocol ip prio 100 route to 1 classid 1:2
67
68H. Assign routes to 10.11.12.0/24 to realm 1
69
70ip route add 10.11.12.0/24 dev eth1 via whatever realm 1
71
72etc. The same thing can be made with rules.
73I still did not test ipchains, but they should work too.
74
75Setup of rsvp and u32 classifiers is more hairy.
76If you read RSVP specs, you will understand how rsvp classifier
77works easily. What's about u32... That's example:
78
79
80
81#! /bin/sh
82
83TC=/home/root/tc
84
85# Setup classifier root on eth1 root (it is cbq)
86$TC filter add dev eth1 parent 1:0 prio 5 protocol ip u32 87 88# Create hash table of 256 slots with ID 1: 89$TC filter add dev eth1 parent 1:0 prio 5 handle 1: u32 divisor 256
90
91# Add to 6th slot of hash table rule to select tcp/telnet to 193.233.7.75
92# direct it to class 1:4 and prescribe to fall to best effort,
93# if traffic violate TBF (32kbit,5K)
94$TC filter add dev eth1 parent 1:0 prio 5 u32 ht 1:6: \ 95 match ip dst 193.233.7.75 \ 96 match tcp dst 0x17 0xffff \ 97 flowid 1:4 \ 98 police rate 32kbit buffer 5kb/8 mpu 64 mtu 1514 index 1 99 100# Add to 1th slot of hash table rule to select icmp to 193.233.7.75 101# direct it to class 1:4 and prescribe to fall to best effort, 102# if traffic violate TBF (10kbit,5K) 103$TC filter add dev eth1 parent 1:0 prio 5 u32 ht 1:: \
104	sample ip protocol 1 0xff \
105	match ip dst 193.233.7.75 \
106	flowid 1:4 \
107	police rate 10kbit buffer 5kb/8 mpu 64 mtu 1514 index 2
108
109# Lookup hash table, if it is not fragmented frame
110# Use protocol as hash key
111\$TC filter add dev eth1 parent 1:0 prio 5 handle ::1 u32 ht 800:: \
112	match ip nofrag \
113	offset mask 0x0F00 shift 6 \
114	hashkey mask 0x00ff0000 at 8 \
116
117
118Alexey Kuznetsov
119kuznet@ms2.inr.ac.ru
120

1lnstat - linux networking statistics
2(C) 2004 Harald Welte <laforge@gnumonks.org
3======================================================================
4
5This tool is a generalized and more feature-complete replacement for the old
6'rtstat' program.
7
8In addition to routing cache statistics, it supports any kind of statistics
9the linux kernel exports via a file in /proc/net/stat.  In a stock 2.6.9
10kernel, this is
11	per-protocol neighbour cache statistics
12		(ipv4, ipv6, atm, decnet)
13	routing cache statistics
14		(ipv4)
15	connection tracking statistics
16		(ipv4)
17
19added to the kernel at some later point
20
21I personally always like examples more than any reference documentation, so I
22list the following examples.  If somebody wants to do a manpage, feel free
23to send me a patch :)
24
25EXAMPLES:
26
27In order to get a list of supported statistics files, you can run
28
29	lnstat -d
30
31It will display something like
32
33/proc/net/stat/arp_cache:
34         1: entries
35         2: allocs
36         3: destroys
37[...]
38/proc/net/stat/rt_cache:
39         1: entries
40         2: in_hit
41         3: in_slow_tot
42
43You can now select the files/keys you are interested by something like
44
45	lnstat -k arp_cache:entries,rt_cache:in_hit,arp_cache:destroys
46
47arp_cach|rt_cache|arp_cach|
48 entries|  in_hit|destroys|
49       6|       6|       0|
50       6|       0|       0|
51       6|       2|       0|
52
53
54You can specify the interval (e.g. 10 seconds) by:
55
56	lnstat -i 10
57
58You can specify to only use one particular statistics file:
59
60	lnstat -f ip_conntrack
61
62You can specify individual field widths
63
64	lnstat -k arp_cache:entries,rt_cache:entries -w 20,8
65
66You can specify not to print a header at all
67
68	lnstat -s 0
69
70You can specify to print a header only at start of the program
71
72	lnstat -s 1
73
74You can specify to print a header at start and every 20 lines:
75
76	lnstat -s 20
77
78You can specify the number of samples you want to take (e.g. 5):
79
80	lnstat -c 5
81
82