Go to file
2023-10-24 11:20:13 +01:00
.circleci Remove the non-maintained CMake build system. 2023-04-19 17:06:45 +08:00
.github PR template 2023-10-19 09:32:52 +02:00
doc Update everything to reference the simpler tool autodetection 2023-06-25 02:07:49 +08:00
examples Simplify tuntap_open by using one function prototype for all OS 2023-08-03 21:40:31 +01:00
include Simplify tuntap_open by using one function prototype for all OS 2023-08-03 21:40:31 +01:00
legacy Code rework changes 2019-04-27 15:55:07 +02:00
packages Added prerequisite 2023-08-31 08:19:34 +02:00
scripts Fix last seen edge case 2023-10-24 11:20:13 +01:00
src Ensure the code style is kept 2023-10-24 11:20:13 +01:00
tests moved compression code into transforms (#961) 2022-02-21 10:09:06 +01:00
thirdparty re-enabled libnatpmp with CMake on Windows (#918) 2021-12-30 09:49:39 +01:00
tools Add tweaks to support windows XP 2023-08-03 21:40:31 +01:00
wireshark Add dissector port note 2019-08-15 18:13:59 +02:00
.gitignore Use a simple debian/control Architecture 2023-08-30 20:27:14 +01:00
.gitmodules added port forwarding (upnp and natpmp) (#905) 2021-12-23 12:27:55 +01:00
.yamllint.yml Linting for yaml files (#872) 2021-10-25 01:37:21 +05:45
autogen.sh The autogen script is not using any bash features 2023-06-25 19:25:00 +08:00
CHANGELOG.md updated CHANGELOG.md 2020-08-07 22:26:32 +05:45
community.list removed begin and end from reg exp 2020-09-16 02:41:50 +05:45
config.mak.in A bunch of hacks to allow builds to understand the stupid windows filenames 2023-07-03 02:51:20 +08:00
configure.ac A bunch of hacks to allow builds to understand the stupid windows filenames 2023-07-03 02:51:20 +08:00
contributors.txt Updated contributors 2020-08-12 12:21:07 +02:00
COPYING Initial SVN import of n2n v2 2016-10-23 10:46:15 +02:00
edge.8 support linux l2 bridge (#1044) 2023-05-04 11:00:38 +08: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
Makefile Try to simplify and improve windows objs definitions 2023-08-03 21:40:31 +01:00
n2n.7 Typo 2022-12-19 23:57:51 +01:00
README.md Remove the non-maintained CMake build system. 2023-04-19 17:06:45 +08:00
supernode.1 added optional choice of bind address (-p) to supernode (#1016) 2022-06-16 12:00:48 +02:00
uncrustify.cfg Basic C Code lint checker and shell checker (#859) 2021-10-24 01:21:18 +05:45
VERSION moved dev to version 3.1.1 2022-03-31 14:39:11 +02:00

Build Status

n2n

n2n is a light VPN software which makes it easy to create virtual networks bypassing intermediate firewalls.

In order to start using n2n, two elements are required:

  • A supernode: it allows edge nodes to announce and discover other nodes. It must have a port publicly accessible on internet.
  • edge nodes: the nodes which will be a part of the virtual networks

A virtual network shared between multiple edge nodes in n2n is called a community. A single supernode can relay multiple communities and a single computer can be part of multiple communities at the same time. An encryption key can be used by the edge nodes to encrypt the packets within their community.

n2n tries to establish a direct peer-to-peer connection via udp between the edge nodes when possible. When this is not possible (usually due to special NAT devices), the supernode is also used to relay the packets.

Quick Setup

Some Linux distributions already provide n2n as a package so a simple sudo apt install n2n will do the work. Alternatively, up-to-date packages for most distributions are available on ntop repositories.

On host1 run:

$ sudo edge -c mynetwork -k mysecretpass -a 192.168.100.1 -f -l supernode.ntop.org:7777

On host2 run:

$ sudo edge -c mynetwork -k mysecretpass -a 192.168.100.2 -f -l supernode.ntop.org:7777

Now the two hosts can ping each other.

IMPORTANT It is strongly advised to choose a custom community name (-c) and a secret encryption key (-k) in order to prevent other users from connecting to your computer. For the privacy of your data sent and to reduce the server load of supernode.ntop.org, it is also suggested to set up a custom supernode as explained below.

Setting up a Custom Supernode

You can create your own infrastructure by setting up a supernode on a public server (e.g. a VPS). You just need to open a single port (1234 in the example below) on your firewall (usually iptables).

  1. Install the n2n package
  2. Edit /etc/n2n/supernode.conf and add the following:
    -p=1234
    
  3. Start the supernode service with sudo systemctl start supernode
  4. Optionally enable supernode start on boot: sudo systemctl enable supernode

Now the supernode service should be up and running on port 1234. On your edge nodes you can now specify -l your_supernode_ip:1234 to use it. All the edge nodes must use the same supernode.

Manual Compilation

On Linux, compilation from source is straight forward:

./autogen.sh
./configure
make

# optionally install
make install

For Windows, MacOS, optimizations and general building options, please check out Building documentation for compilation and running.

IMPORTANT It is generally recommended to use the latest stable release. Please note that the current dev branch usually is not guaranteed to be backward compatible neither with the latest stable release nor with previous dev states. On the other hand, if you dare to try bleeding edge features, you are encouraged to compile from dev just keep track of sometimes rapidly occuring changes. Feedback in the Issues section is appreciated.

Security Considerations

When payload encryption is enabled (provide a key using -k), the supernode will not be able to decrypt the traffic exchanged between two edge nodes but it will know that edge A is talking with edge B.

The choice of encryption schemes that can be applied to payload has recently been enhanced. Please have a look at Crypto description for a quick comparison chart to help make a choice. n2n edge nodes use AES encryption by default. Other ciphers can be chosen using the -A_ option.

A benchmark of the encryption methods is available when compiled from source with tools/n2n-benchmark.

The header which contains some metadata like the virtual MAC address of the edge nodes, their IP address, their real hostname and the community name optionally can be encrypted applying -H on the edges.

Advanced Configuration

More information about communities, support for multiple supernodes, routing, traffic restrictions and on how to run an edge as a service is available in the more detailed documentation.

Contribution

You can contribute to n2n in various ways:

  • Update an open issue or create a new one with detailed information
  • Propose new features
  • Improve the documentation
  • Provide pull requests with enhancements

For details about the internals of n2n check out the Hacking guide.

Answers to frequently asked questions can be found in our FAQ document.

Here is a list of third-party projects connected to this repository:

  • Collection of pre-built binaries for Windows: lucktu
  • n2n for Android: hin2n
  • Docker images: Docker Hub
  • Go bindings, management daemons and CLIs for n2n edges and supernodes, Docker, Kubernetes & Helm Charts: pojntfx/gon2n
  • Windows GUI (along with a custom version of n2n) but also working with regular n2n: HappyNet

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