2019-05-30 19:39:48 +08:00
|
|
|
n2n
|
|
|
|
===
|
|
|
|
|
|
|
|
[n2n][1] 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.
|
|
|
|
|
2019-07-10 01:20:00 +08:00
|
|
|
```
|
|
|
|
.............VPN................
|
|
|
|
+------LAN-+-----+ +- Edge.
|
|
|
|
| . | / .
|
|
|
|
| Client ->.Edge +-> Supernode <-+- Edge .
|
|
|
|
| . | \ .
|
|
|
|
+----------+-----+ +- Edge.
|
|
|
|
................................
|
|
|
|
```
|
|
|
|
|
2019-07-10 01:59:59 +08:00
|
|
|
## Supernode (eth0:1.2.3.4)
|
2019-07-10 01:20:00 +08:00
|
|
|
|
|
|
|
```bash
|
|
|
|
$ docker-compose up -d supernode
|
|
|
|
```
|
|
|
|
|
2019-07-10 01:59:59 +08:00
|
|
|
## Edge (eth0:192.168.1.23/24, n2n0:192.168.100.x/24)
|
2019-07-09 14:09:16 +08:00
|
|
|
|
|
|
|
```bash
|
2019-07-10 01:20:00 +08:00
|
|
|
$ docker-compose up -d edge
|
|
|
|
$ sysctl -w net.ipv4.ip_forward=1
|
|
|
|
$ iptables -t nat -A POSTROUTING -o n2n0 -j MASQUERADE
|
|
|
|
```
|
2019-07-09 14:09:16 +08:00
|
|
|
|
2019-07-10 01:59:59 +08:00
|
|
|
## Client (eth0:192.168.1.45/24)
|
2019-07-10 01:20:00 +08:00
|
|
|
|
|
|
|
```bash
|
|
|
|
$ ip route add 192.168.100.0/24 via 192.168.1.23
|
2019-07-10 01:59:59 +08:00
|
|
|
$ nmap -sP 192.168.100.0/24
|
2019-07-09 14:09:16 +08:00
|
|
|
```
|
|
|
|
|
2019-05-30 19:39:48 +08:00
|
|
|
[1]: https://www.ntop.org/products/n2n/
|