ifpps: fixed obsolete help text
[netsniff-ng.git] / INSTALL
blob4b03c2cc657fbe658457c52d436f455ffd5c90f3
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 tools are required to build netsniff-ng?
14  - gcc, make et al. (all)
15  - ccache (optional)
16  - flex, bison (bpfc, trafgen)
17  - asciidoc (man-pages)
19 What libraries are required?
21  - glibc (all)
22  - libncurses (ifpps, flowtop)
23  - libGeoIP >=1.4.8 (astraceroute, flowtop)
24  - libnacl (curvetun)
25  - libnetfilter-conntrack (flowtop)
26  - liburcu (flowtop)
27  - libnl3 (netsniff-ng, trafgen)
28  - libnet (mausezahn)
29  - libpcap (mausezahn)
30  - libcli (mausezahn)
32 What additional tools are recommended after the build?
34  - cpp (trafgen)
35  - ntpd (curvetun)
36  - setcap (all)
38 It is common, that these libraries are shipped as distribution packages
39 for an easy installation. We try to keep this as minimal as possible.
41 After downloading the netsniff-ng toolkit, you should change to 'src':
43   $ cd netsniff-ng/src/
45 The installation (deinstallation) process done by make is fairly simple:
47   $ make
48   # make install
50   (# make distclean)
51   ($ make clean)
52   (or for both at once: # make mrproper)
54 You can also build only a particular tool, e.g.:
55   
56   $ make trafgen
57   # make trafgen_install
59   (# make trafgen_distclean)
60   ($ make trafgen_clean)
62 Currently mausezahn is experimental and not included in the default repository
63 resp. build:
65   $ git pull origin with-mausezahn
67 This means if you want to use mausezahn, you have to execute 'make mausezahn'
68 for a build. This will be changed at the time when we have cleaned up and
69 fixed the imported code.
71 If you want to build all tools, but curvetun (i.e. because you don't need
72 the tunneling software and the NaCl build process lasts quite long):
74   $ make allbutcurvetun
75   # make install_allbutcurvetun
77   (# make mrproper)
79 In order to build curvetun, libnacl must be built first. A helper script
80 called build_nacl.sh is there to facilitate this process. If you want to
81 build NaCl in the directory ~/nacl, the script should be called this way:
83   $ cd src/curvetun
84   $ ./build_nacl.sh ~/nacl
86 There's also an abbreviation for this by simply typing:
88   $ make nacl
90 This gives an initial output such as "Building NaCl for arch amd64 on host
91 fuuubar (grab a coffee, this takes a while) ...". If the automatically
92 detected architecture (such as amd64) is not the one you intend to compile
93 for, then edit the (cc="gcc") variable within the build_nacl.sh script to
94 your cross compiler. Yes, we know, the build system of NaCl is a bit of a
95 pain, so you might check for a pre-built package from your distribution in
96 case you are not cross compiling.
98 If NaCl already has been built on the target, it is quicker to use
99 nacl_path.sh this way:
101   $ cd src/curvetun
102   $ ./nacl_path.sh ~/nacl/build/include/x86 ~/nacl/build/lib/x86
104 When done, netsniff-ng's build infrastructure will read those evironment
105 variables in order to get the needed paths to NaCl.
107 In case you have to manually install libgeoip in version 1.4.8 or higher, you
108 can also use the provided helper script called build_geoip.sh from the
109 src/astraceroute directory (depending on your distribution, you might want to
110 adapt paths within the script):
112   $ cd src/astraceroute
113   # ./build_geoip.sh
115 Again, there's also an abbreviation for this by simply typing:
117   # make geoip
119 For downloading the latest GeoIP database, you should use the script that
120 is located at scripts/geoip-database-update, or use:
122   # make update
124 If you're unsure with any make targets, check out: make help
126 In order to run the toolkit as a normal user, set the following privilege
127 separation after the build/installation:
129   $ sudo setcap cap_net_raw,cap_ipc_lock,cap_sys_admin,cap_net_admin=eip {toolname}
131 Man pages are generated out of the files from Documentation/Manpages dir.
132 They are written in asciidoc format. For this, you need the tool asciidoc which
133 is distributed with on most Linux systems.
135 For bpfc, we also have a Vim syntax highlighting file. Have a look at
136 scripts/bpf.vim for installation instructions.
138 netsniff-ng has been successfully tested on x86 and x86_64. It should also run
139 on most other major architectures. However, since we don't have a possibility
140 to test it, please drop us a short mail, if it runs successfully on hardware
141 other than x86/x86_64.
143 For using TUN/TAP devices as a user, e.g. create a file called
144 src/50-tuntap.rules in /etc/udev/rules.d/ with ...
146 KERNEL=="tun",NAME="net/%k",GROUP="netdev",MODE="0660",OPTIONS+="ignore_remove"
148 ... and restart the udev daemon. Add yourself to the "netdev" group.
150 Add the flag -D__WITH_HARDWARE_TIMESTAMPING=1 into src/Makefile for
151 hardware timestamping support. Note that your kernel must be configured for
152 this (e.g. to ship the linux/net_tstamp.h header file).
154 The following warnings can be seen when compiling bpfc with flex 2.5.35 and
155 bison 2.4.1:
156  - redundant redeclaration of ‘isatty’
157  - cannot optimize loop, the loop counter may overflow
159 Those two warnings occur on generated C code produced by flex and bison and
160 there is no possibility on our side to fix them while staying with both tools.
162 Similar to that, gcc will throw a warning on strchr(3) which is a false
163 positive (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36513) from glibc:
164  - warning: logical ‘&&’ with non-zero constant will always evaluate as true
166 For cross-compiling netsniff-ng, the process is faily simple. Assuming you
167 want to build netsniff-ng for the Microblaze architecture, update the PATH
168 variable first, e.g.:
170   $ export PATH=<cc-tools-path>/microblazeel-unknown-linux-gnu/bin:$PATH
172 And then, build the toolkit like this:
174   $ make CROSS_COMPILE=microblazeel-unknown-linux-gnu- \
175          CROSS_LD_LIBRARY_PATH=<cc-lib-search-path>
177 Note that some adaptations might be necessary regarding the CFLAGS, since not
178 all might be supported by a different architecture.
180 For doing a debug build of the toolkit with less optimizations and non-stripped
181 symbols, do:
183   $ make DEBUG=1
185 For debugging the build system, full commands are shown if every make target is
186 executed with:
188   $ make Q=
190 Concerning packaging the toolkit for a Linux distribution, by default,
191 netsniff-ng has some architecture-specific tuning options enabled that don't
192 belong into a package binary of a distribution. Hence, you might want to adapt
193 some build-related things before starting to package the toolkit. All
194 necessary things (e.g., CFLAGS,WFLAGS) can be found in src/Makefile. Hence,
195 you need to adapt it there. You can then build and install the toolkit into
196 a prefixed path like:
198   $ make PREFIX=<path-prefix-for-package>
199   $ make PREFIX=<path-prefix-for-package> install
201 Thanks for maintaining netsniff-ng in your distribution. Further questions
202 will be answered on the public mainling list.