netsniff-ng: also support tcpdump-like filters
[netsniff-ng.git] / INSTALL
bloba922efa5f7f3d794fc471663dea6e78da4cdb770
1 Currently only operating systems running on Linux kernels with the option
2 CONFIG_PACKET_MMAP enabled. This feature can be found even back to the days of
3 2.4 kernels. Most operating systems ship pre-compiled kernels that have this
4 config option enabled and even the latest kernel versions got rid of this
5 option and have this functionality already built-in. However, we recommend a
6 kernel >= 2.6.31, because the TX_RING is officially integrated since then. In
7 any case, if you have the possibility, consider getting the latest kernel from
8 Linus' Git repository, tweak and compile it, and run this one!
10 A note for distribution package maintainers can be found at the end of the file.
12 What additional tools are required to build netsniff-ng?
14  - ccache (optional)
15  - flex, bison (bpfc, trafgen)
17 What libraries are required?
19  - libncurses (ifpps, flowtop)
20  - libGeoIP >=1.4.8 (astraceroute, flowtop)
21  - libnacl (curvetun)
22  - libnetfilter-conntrack (flowtop)
23  - libpcap (netsniff-ng, for tcpdump-like filters)
24  - liburcu (flowtop)
25  - libnl3 (netsniff-ng, trafgen)
27 For experimental tools (mausezahn branch):
29  - libnet (mausezahn)
30  - libpcap (mausezahn)
31  - libcli (mausezahn)
33 What additional tools are recommended after the build?
35  - cpp (trafgen)
36  - ntpd (curvetun)
37  - setcap (all)
39 It is common, that these libraries are shipped as distribution packages
40 for an easy installation. We try to keep this as minimal as possible.
42 One-liner installation for *all* dependencies on Debian:
44   $ sudo apt-get install ccache flex bison libnl-3-dev \
45   libnl-genl-3-dev libgeoip-dev libnetfilter-conntrack-dev \
46   libncurses5-dev liburcu-dev libnacl-dev libnet1-dev \
47   libpcap-dev libcli-dev
49 One-liner installation for *all* dependencies on Fedora:
51   $ sudo yum install ccache flex bison ccache libnl3-devel \
52   GeoIP-devel libnetfilter_conntrack-devel ncurses-devel \
53   userspace-rcu-devel nacl-devel libnet-devel libpcap-devel \
54   libcli-devel
56 After downloading the netsniff-ng toolkit, you should change to 'src':
58   $ cd netsniff-ng/src/
60 The installation (deinstallation) process done by make is fairly simple:
62   $ make
63   # make install
65   (# make distclean)
66   ($ make clean)
67   (or for both at once: # make mrproper)
69 You can also build only a particular tool, e.g.:
70   
71   $ make trafgen
72   # make trafgen_install
74   (# make trafgen_distclean)
75   ($ make trafgen_clean)
77 Currently mausezahn is experimental and not included in the default repository
78 resp. build:
80   $ git pull origin with-mausezahn
82 This means if you want to use mausezahn, you have to execute 'make mausezahn'
83 for a build. This will be changed at the time when we have cleaned up and
84 fixed the imported code.
86 If you want to build all tools, but curvetun (i.e. because you don't need
87 the tunneling software and the NaCl build process lasts quite long):
89   $ make allbutcurvetun
90   # make install_allbutcurvetun
92   (# make mrproper)
94 In order to build curvetun, libnacl must be built first. A helper script
95 called build_nacl.sh is there to facilitate this process. If you want to
96 build NaCl in the directory ~/nacl, the script should be called this way:
98   $ cd src/curvetun
99   $ ./build_nacl.sh ~/nacl
101 There's also an abbreviation for this by simply typing:
103   $ make nacl
105 This gives an initial output such as "Building NaCl for arch amd64 on host
106 fuuubar (grab a coffee, this takes a while) ...". If the automatically
107 detected architecture (such as amd64) is not the one you intend to compile
108 for, then edit the (cc="gcc") variable within the build_nacl.sh script to
109 your cross compiler. Yes, we know, the build system of NaCl is a bit of a
110 pain, so you might check for a pre-built package from your distribution in
111 case you are not cross compiling.
113 If NaCl already has been built on the target, it is quicker to use
114 nacl_path.sh this way:
116   $ cd src/curvetun
117   $ ./nacl_path.sh ~/nacl/build/include/x86 ~/nacl/build/lib/x86
119 When done, netsniff-ng's build infrastructure will read those evironment
120 variables in order to get the needed paths to NaCl.
122 In case you have to manually install libgeoip in version 1.4.8 or higher, you
123 can also use the provided helper script called build_geoip.sh from the
124 src/astraceroute directory (depending on your distribution, you might want to
125 adapt paths within the script):
127   $ cd src/astraceroute
128   # ./build_geoip.sh
130 Again, there's also an abbreviation for this by simply typing:
132   # make geoip
134 For downloading the latest GeoIP database, you should use the script that
135 is located at scripts/geoip-database-update, or use:
137   # make update
139 If you're unsure with any make targets, check out: make help
141 In order to run the toolkit as a normal user, set the following privilege
142 separation after the build/installation:
144   $ sudo setcap cap_net_raw,cap_ipc_lock,cap_sys_admin,cap_net_admin=eip {toolname}
146 Man pages are generated out of the files from Documentation/Manpages dir.
147 They are written in asciidoc format. For this, you need the tool asciidoc which
148 is distributed with on most Linux systems.
150 For bpfc, we also have a Vim syntax highlighting file. Have a look at
151 scripts/bpf.vim for installation instructions.
153 netsniff-ng has been successfully tested on x86 and x86_64. It should also run
154 on most other major architectures. However, since we don't have a possibility
155 to test it, please drop us a short mail, if it runs successfully on hardware
156 other than x86/x86_64.
158 For using TUN/TAP devices as a user, e.g. create a file called
159 src/50-tuntap.rules in /etc/udev/rules.d/ with ...
161 KERNEL=="tun",NAME="net/%k",GROUP="netdev",MODE="0660",OPTIONS+="ignore_remove"
163 ... and restart the udev daemon. Add yourself to the "netdev" group.
165 Add the flag -D__WITH_HARDWARE_TIMESTAMPING=1 into src/Makefile for
166 hardware timestamping support. Note that your kernel must be configured for
167 this (e.g. to ship the linux/net_tstamp.h header file).
169 The following warnings can be seen when compiling bpfc with flex 2.5.35 and
170 bison 2.4.1:
171  - redundant redeclaration of ‘isatty’
172  - cannot optimize loop, the loop counter may overflow
174 Those two warnings occur on generated C code produced by flex and bison and
175 there is no possibility on our side to fix them while staying with both tools.
177 Similar to that, gcc will throw a warning on strchr(3) which is a false
178 positive (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36513) from glibc:
179  - warning: logical ‘&&’ with non-zero constant will always evaluate as true
181 For cross-compiling netsniff-ng, the process is faily simple. Assuming you
182 want to build netsniff-ng for the Microblaze architecture, update the PATH
183 variable first, e.g.:
185   $ export PATH=<cc-tools-path>/microblazeel-unknown-linux-gnu/bin:$PATH
187 And then, build the toolkit like this:
189   $ make CROSS_COMPILE=microblazeel-unknown-linux-gnu- \
190          CROSS_LD_LIBRARY_PATH=<cc-lib-search-path>
192 Note that some adaptations might be necessary regarding the CFLAGS, since not
193 all might be supported by a different architecture.
195 For doing a debug build of the toolkit with less optimizations and non-stripped
196 symbols, do:
198   $ make DEBUG=1
200 For debugging the build system, full commands are shown if every make target is
201 executed with:
203   $ make Q=
205 Concerning packaging the toolkit for a Linux distribution, by default,
206 netsniff-ng has some architecture-specific tuning options enabled that don't
207 belong into a package binary of a distribution. Hence, you might want to adapt
208 some build-related things before starting to package the toolkit. All
209 necessary things (e.g., CFLAGS,WFLAGS) can be found in src/Makefile. Hence,
210 you need to adapt it there. You can then build and install the toolkit into
211 a prefixed path like:
213   $ make PREFIX=<path-prefix-for-package>
214   $ make PREFIX=<path-prefix-for-package> install
216 Thanks for maintaining netsniff-ng in your distribution. Further questions
217 will be answered on the public mainling list.