中文 English

How to Run N2N on CentOS 7 — Compilation Guide

Published: 2021-01-14
network N2N

If you are interested in the complete compilation process, you can browse at your leisure. Of course, you can also directly download the pre-compiled files.

A Quick Review of N2N’s Core Concepts

N2N is a lightweight VPN software that allows you to easily create virtual networks that bypass intermediate firewalls. To get started with N2N, two elements are required:

  • 一个超级节点(supernode): It allows edge nodes to announce and discover other nodes. It must have a port that can be publicly accessed on the Internet.

  • 边缘节点(node): Nodes that will become part of a virtual network. A virtual network shared among 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 simultaneously. Edge nodes can encrypt packets within a community using an encryption key.

N2N attempts to establish direct 对等连接(p2p) between edge nodes via UDP whenever possible. If this is not possible (typically due to restrictive NAT devices), the supernode is also used to relay packets.

Pre-compiled Files

Compilation environment: CentOS Linux release 7.9.2009 (Core) Linux version 3.10.0-1160.11.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Fri Dec 18 16:34:56 UTC 2020

wget https://download.margrop.net/d/oneindex/network/n2n_2.8_stable/CentOS7/edge -O edge
wget https://download.margrop.net/d/oneindex/network/n2n_2.8_stable/CentOS7/supernode -O supernode

Environment Setup and Starting Compilation

yum install -y openssl-devel cmake net-tools git gcc gcc-c++

The current latest version is 2.8-stable

cd ~
git clone https://github.com/ntop/n2n
cd n2n
git checkout 2.8-stable
mkdir build
cd build
cmake .. 
make && make install