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:
9 a kernel module, ipfw_mod.ko
10 a userland program, /sbin/ipfw
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.
17 === To compile for a 2.6 kernel, simply run
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.
25 You can override the default kernel tree with
27 make KERNELPATH=your_kernel_source_tree
29 NOTE: make sure CONFIG_NETFILTER is enabled in the kernel
30 configuration file. You can enable it by doing
32 "(cd ${KERNELPATH}; make menuconfig)"
34 and enabling the option listed below:
37 Networking options --->
38 [*] Network packet filtering framework (Netfilter)
41 === To compile for a 2.4 kernel:
43 make VER=2.4 KERNELPATH=...
45 You need to follow the same instruction for the 2.6 kernel, enabling
48 Networking options --->
49 [*] Network packet filtering (replaces ipchains)
51 === To build an Openwrt package
53 (Tested with kamikaze_8.09.1 and Linux 2.4)
55 + Download and extract the OpenWrt package, e.g.
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
60 + "cd" to the directory with the OpenWrt sources (the one that
61 contains Config.in, rules.mk ...)
65 + Optional: to be sure that the tools are working, make a first
66 compilation as follows:
68 - run "make menuconfig" and set the correct target device,
70 - run "make" to do the build
72 + Add ipfw2 to the openwrt package, as follows:
74 - fetch and extract the code e.g.
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;)
80 (but you should have done it already)
82 - run the following commands:
84 cp ../ipfw_linux/Makefile.openwrt package/ipfw2/Makefile)
86 to create the package/ipfw2 directory in the OpenWrt source
87 directory, and copy Makefile.openwrt to package/ipfw2/Makefile:
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);
93 - run "make menuconfig" and select ipfw2 as a module <M> in
94 Kernel Modules -> Other modules -> ipfw2
96 - run "make" to build the package, "make V=99" for verbose build.
98 The resulting package is located in bin/packages/mipsel/kmod-ipfw2*,
99 upload the file and install on the target system, as follows:
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
107 -----------------------------------------------------------------------------