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