Go to file
Emanuele Faranda b84cedd8b8 Add support for multi-service n2n edge
E.g. systemctl start edge@n2n1 will read /etc/n2n/edge-n2n1.conf
2018-11-28 13:04:44 +01:00
android Merge pull request #15 from switch-iot/pr2ntop 2018-06-26 14:11:39 +02:00
doc Added instructions for using n2n on MacOS 2018-06-06 18:37:24 +02:00
openwrt/kamikaze Initial SVN import of n2n v2 2016-10-23 10:46:15 +02:00
packages Add support for multi-service n2n edge 2018-11-28 13:04:44 +01:00
win32 Merge of https://github.com/ntop/n2n/pull/26 2018-08-17 14:27:11 +02:00
autogen.sh Autogen for generatic configure 2018-10-07 11:38:05 +02:00
benchmark.c Merge of https://github.com/ntop/n2n/pull/26 2018-08-17 14:27:11 +02:00
CHANGELOG.md Added changelog file 2018-08-17 14:47:37 +02:00
CMakeLists.txt Merge of https://github.com/ntop/n2n/pull/26 2018-08-17 14:27:11 +02:00
community.list Added the ability to specify (-c) on the supernode the list of allowed communities 2018-09-28 22:31:45 +02:00
config.guess Added configure and autogen.sh 2018-10-07 11:37:19 +02:00
configure.ac Added configure and autogen.sh 2018-10-07 11:37:19 +02:00
contributors.txt Refreshed copyright and added contributors list 2018-06-06 09:57:31 +02:00
COPYING Initial SVN import of n2n v2 2016-10-23 10:46:15 +02:00
edge_utils.c Fix packets from clients being routed when routing is disabled 2018-10-31 13:08:39 +01:00
edge.8 Initial SVN import of n2n v2 2016-10-23 10:46:15 +02:00
edge.c When multiple supernodes are specified, the edge registers to all of them 2018-09-29 13:08:01 +02:00
example_edge_embed.c Added termination variable to edge loop 2018-06-08 12:01:03 +02:00
gen_keyfile.py Initial SVN import of n2n v2 2016-10-23 10:46:15 +02:00
INSTALL Initial SVN import of n2n v2 2016-10-23 10:46:15 +02:00
LICENSE Initial commit 2016-10-23 10:42:16 +02:00
lzoconf.h Initial SVN import of n2n v2 2016-10-23 10:46:15 +02:00
lzodefs.h Initial SVN import of n2n v2 2016-10-23 10:46:15 +02:00
Makefile.in Fixes for OS X build with Macports 2018-10-09 17:28:09 +02:00
minilzo.c Initial SVN import of n2n v2 2016-10-23 10:46:15 +02:00
minilzo.h Initial SVN import of n2n v2 2016-10-23 10:46:15 +02:00
n2n_keyfile.c Refreshed copyright and added contributors list 2018-06-06 09:57:31 +02:00
n2n_keyfile.h Refreshed copyright and added contributors list 2018-06-06 09:57:31 +02:00
n2n_transforms.h Code rework 2018-06-08 00:17:42 +02:00
n2n_wire.h Initial work for local multicast registering (work in progress) 2018-09-28 22:32:36 +00:00
n2n.7 Reworked debian/ubuntu packaging 2018-06-20 20:23:28 +02:00
n2n.c Initial work for local multicast registering (work in progress) 2018-09-28 22:32:36 +00:00
n2n.h Added configure and autogen.sh 2018-10-07 11:37:19 +02:00
n2n.spec Moved to 2.3.x release 2018-06-08 08:21:27 +02:00
README.md Added link to binary packages 2018-10-04 12:24:14 +02:00
sn.c Added the ability to specify (-c) on the supernode the list of allowed communities 2018-09-28 22:31:45 +02:00
supernode.1 Initial SVN import of n2n v2 2016-10-23 10:46:15 +02:00
test.c Refreshed copyright and added contributors list 2018-06-06 09:57:31 +02:00
transform_aes.c Refreshed copyright and added contributors list 2018-06-06 09:57:31 +02:00
transform_null.c Refreshed copyright and added contributors list 2018-06-06 09:57:31 +02:00
transform_tf.c Trace lines are now shorter 2018-06-14 12:30:38 +02:00
tuntap_freebsd.c Fix a few leftover instances which used the old function name 2018-08-18 11:42:22 +04:30
tuntap_linux.c Minor code cleanup 2018-06-07 21:45:33 +02:00
tuntap_netbsd.c Refreshed copyright and added contributors list 2018-06-06 09:57:31 +02:00
tuntap_osx.c Refreshed copyright and added contributors list 2018-06-06 09:57:31 +02:00
twofish.c Initial SVN import of n2n v2 2016-10-23 10:46:15 +02:00
twofish.h Initial SVN import of n2n v2 2016-10-23 10:46:15 +02:00
uthash.h Added the ability to specify (-c) on the supernode the list of allowed communities 2018-09-28 22:31:45 +02:00
version.c Added configure and autogen.sh 2018-10-07 11:37:19 +02:00
wire.c Refreshed copyright and added contributors list 2018-06-06 09:57:31 +02:00

N2N

Edge node

You need to start an edge node on each host you want to connect with the same community.

Enable the edge process

$ sudo ./edge -d n2n0 -c mynetwork -k encryptme -u 99 -g 99 -m 3C:A0:12:34:56:78 -a 1.2.3.4 -l a.b.c.d:xyw

or

$ N2N_KEY=encryptme sudo ./edge -d n2n0 -c mynetwork -u 99 -g 99 -m 3C:A0:12:34:56:78 -a 1.2.3.4 -l a.b.c.d:xyw

By defaul the edge will run in background but you can use the -f option to keep it in foreground.

Note that -d, -u, -g and -f options are not available for Windows.

Supernode

You need to start the supernode once (no need to be root unless you want to use a privileged port)

  1. ./supernode -l 1234 -v

Dropping Root Privileges and SUID-Root Executables (UNIX)

The edge node uses superuser privileges to create a TAP network interface device. Once this is created root privileges are not required and can constitute a security hazard if there is some way for an attacker to take control of an edge process while it is running. Edge will drop to a non-privileged user if you specify the -u <uid> and -g <gid> options. These are numeric IDs. Consult /etc/passwd.

You may choose to install edge SUID-root to do this:

  1. Become root
  2. chown root:root edge
  3. chmod +s edge
  4. done

Any user can now run edge. You may not want this, but it may be convenient and safe if your host has only one login user.

Running As a Daemon (UNIX)

Unless given -f as a command line option, edge will call daemon(3) after successful setup. This causes the process to fork a child which closes stdin, stdout and stderr then sets itself as process group leader. When this is done, the edge command returns immediately and you will only see the edge process in the process listings, eg. from ps or top.

If the edge command returns 0 then the daemon started successfully. If it returns non-zero then edge failed to start up for some reason. When edge starts running as a daemon, all logging goes to syslog daemon.info facility.

IPv6 Support

n2n supports the carriage of IPv6 packets within the n2n tunnel. N2n does not yet use IPv6 for transport between edges and supernodes.

To make IPv6 carriage work you need to manually add IPv6 addresses to the TAP interfaces at each end. There is currently no way to specify an IPv6 address on the edge command line.

eg. under linux:

on hostA: [hostA] $ /sbin/ip -6 addr add fc00:abcd:1234::7/48 dev n2n0

on hostB: [hostB] $ /sbin/ip -6 addr add fc00:abcd:1234::6/48 dev n2n0

You may find it useful to make use of tunctl from the uml-utilities package. Tunctl allow you to bring up a TAP interface and configure addressing prior to starting edge. It also allows edge to be restarted without the interface closing (which would normally affect routing tables).

Once the IPv6 addresses are configured and edge started, IPv6 neighbor discovery packets flow (get broadcast) and IPv6 entities self arrange. Test your IPv6 setup with ping6 - the IPv6 ping command.

Performance Notes

The time taken to perform a ping test for various ciphers is given below:

Test: ping -f -l 8 -s 800 -c 10000 <far_edge>

AES (-O0) 11820 TF (-O0) 25761

TF (-O2) 20554

AES (-O3) 12532 TF (-O3) 14046 NULL (-O3) 10659

N2N Builder (Supernode Docker Image based on Debian)

Running the supernode image

$ docker run --rm -d -p 5645:5645/udp -p 7654:7654/udp supermock/supernode:[TAGNAME]

Binary packages

If you don't like to compile from source, we build stable and nightly builds that you can find at packages.ntop.org.

Docker registry

Documentation

1. Build image and binaries

Use make command to build the images. Before starting the arm32v7 platform build, you need to run this registry, so you can perform a cross-build. Just follow the documentation: https://github.com/multiarch/qemu-user-static/blob/master/README.md

$ TARGET_ARCHITECTURE=[arm32v7, x86_64, (nothing to build all architectures)] make

2. Push it

Use make push command to push the image, TARGET_ARCHITECTURE is necessary.

$ TARGET_ARCHITECTURE=[arm32v7, x86_64] make push

3. Test it

Once the image is built, it's ready to run:

$ docker run --rm -d -p 5645:5645/udp -p 7654:7654/udp supermock/supernode:[TAGNAME]

(C) 2007-2018 - ntop.org and contributors