n2n VPN
Introduction
n2n is a layer-two peer-to-peer virtual private network (VPN) which allows users to exploit features typical of P2P applications at network instead of application level. This means that users can gain native IP visibility (e.g. two PCs belonging to the same n2n network can ping each other) and be reachable with the same network IP address regardless of the network where they currently belong. In a nutshell, as OpenVPN moved SSL from application (e.g. used to implement the https protocol) to network protocol, n2n moves P2P from application to network level.
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.
Installation
Download: https://github.com/ntop/n2n
Ubuntu/Debian
sudo dpkg -i n2n_3.0.0-1038_amd64.deb
sudo apt install -f
Usage
One-liner command in foreground.
# On Linux, change the community, encrypt key and tun IP to your own
# edge -c <community> -k <encrypt key> -a <tun IP address> -l <supernode host:port> -f
sudo edge -c my-community -k my-secret -a 10.9.9.10 -l n2n.lucktu.com:10090 -f
Run as service in background.
# Generate the config file
sudo cp /etc/n2n/edge.conf.sample /etc/n2n/edge.conf
# Start the edge
sudo systemctl start edge
sudo systemctl enable edge
Supernode
sudo supernode -p 10090
相關連結
- https://github.com/ntop/n2n
- n2n for Windows
- n2n GUI for Win
- OpenVPN Download
- Public Supernodes
- ZeroTier - P2P VPN Service
- FRP - Fast Reverse Proxy
- [Video] 【司波图】FRP内网穿透教程,看得完你就会了