Major changes:
[ipfw.git] / README
1 #
2 # $Id$
3 #
4
5 This directory contains a port of ipfw and dummynet to Linux and OpenWrt
6 (a Windows version is in the works but not ready yet).
7 Building the code produces:
8
9         a kernel module,        ipfw_mod.ko
10         a userland program,     /sbin/ipfw
11
12 The source code here comes straight from FreeBSD (roughly the
13 version in RELENG_7 and HEAD as of June 2009), plus some glue code
14 and headers written from scratch.
15 Unless specified otherwise, all the code here is under a BSD license.
16
17 === To compile for a 2.6 kernel, simply run
18
19         make
20
21     Make sure that kernel headers (or sources) are installed on your
22     system, and that the link "/lib/modules/`uname -r`/build" points
23     to the header/source tree matching your kernel.
24
25     You can override the default kernel tree with
26
27         make KERNELPATH=your_kernel_source_tree
28
29     NOTE: make sure CONFIG_NETFILTER is enabled in the kernel
30     configuration file. You can enable it by doing
31     
32         "(cd ${KERNELPATH}; make menuconfig)"
33
34     and enabling the option listed below:
35
36         Networking --->
37             Networking options  --->
38               [*] Network packet filtering framework (Netfilter)
39
40
41 === To compile for a 2.4 kernel:
42
43         make VER=2.4 KERNELPATH=...
44
45     You need to follow the same instruction for the 2.6 kernel, enabling
46     the kernel options:
47
48     Networking options  --->
49       [*] Network packet filtering (replaces ipchains)
50
51 === To build an Openwrt package
52
53     (Tested with kamikaze_8.09.1 and Linux 2.4)
54
55     + Download and extract the OpenWrt package, e.g.
56
57         wget http://downloads.openwrt.org/kamikaze/8.09.1/kamikaze_8.09.1_source.tar.bz2
58         tar xvjf kamikaze_8.09.1_source.tar.bz2
59
60     + "cd" to the directory with the OpenWrt sources (the one that
61       contains Config.in, rules.mk ...)
62
63         cd kamikaze_8.09.1
64
65     + Optional: to be sure that the tools are working, make a first
66       compilation as follows:
67
68         - run "make menuconfig" and set the correct target device,
69           drivers, and so on;
70         - run "make" to do the build
71
72     + Add ipfw2 to the openwrt package, as follows:
73
74       - fetch and extract the code e.g.
75
76         (cd ..; \
77         wget http://info.iet.unipi.it/~luigi/dummynet/ipfw_linux-20090724.tgz;\
78         tar xvzf ipfw_linux-20090724.tgz; mv ipfw_linux-20090724 ipfw_mod;)
79
80         (but you should have done it already)
81
82       - run the following commands:
83         (mkdir package/ipfw2;
84         cp ../ipfw_linux/Makefile.openwrt package/ipfw2/Makefile)
85
86         to create the package/ipfw2 directory in the OpenWrt source
87         directory, and copy Makefile.openwrt to package/ipfw2/Makefile:
88
89       - if necessary, edit package/ipfw2/Makefile and set IPFW_DIR to point to
90         the directory with the ipfw sources (the directory
91         which contains this README, dummynet/ ipfw/ and so on);
92
93       - run "make menuconfig" and select ipfw2 as a module <M> in
94             Kernel Modules -> Other modules -> ipfw2
95
96       - run "make" to build the package, "make V=99" for verbose build.
97
98     The resulting package is located in bin/packages/mipsel/kmod-ipfw2*,
99     upload the file and install on the target system, as follows:
100
101     opkg install  kmod-ipfw2_2.4.35.4-brcm-2.4-1_mipsel.ipk #install
102     ls -l ls -l /lib/modules/2.4.35.4/ipfw*     # check
103     insmod /lib/modules/2.4.35.4/ipfw_mod.o     # load the module
104     /lib/modules/2.4.35.4/ipfw show             # launch the userspace tool
105     rmmod ipfw_mod.o                            # remove the module
106
107 -----------------------------------------------------------------------------