diff --git a/n2n/Dockerfile b/n2n/Dockerfile index f7b8dba..29239fe 100644 --- a/n2n/Dockerfile +++ b/n2n/Dockerfile @@ -7,7 +7,7 @@ MAINTAINER EasyPi Software Foundation RUN set -xe \ && apt update \ - && apt install -y gnupg lsb-release net-tools wget \ + && apt install -y gnupg iptables lsb-release net-tools wget \ && wget http://apt.ntop.org/stretch/all/apt-ntop.deb \ && dpkg -i apt-ntop.deb \ && apt update \ diff --git a/n2n/README.md b/n2n/README.md index 3e00c93..2c3ecd2 100644 --- a/n2n/README.md +++ b/n2n/README.md @@ -5,13 +5,34 @@ n2n users to exploit features typical of P2P applications at network instead of application level. -## up and running +``` + .............VPN................ ++------LAN-+-----+ +- Edge. +| . | / . +| Client ->.Edge +-> Supernode <-+- Edge . +| . | \ . ++----------+-----+ +- Edge. + ................................ +``` + +## Supernode (1.2.3.4) ```bash -$ docker-compose up -d +$ docker-compose up -d supernode +``` -$ docker-compose exec edge bash ->>> ping 192.168.100.1 +## Edge (192.168.1.23) + +```bash +$ docker-compose up -d edge +$ sysctl -w net.ipv4.ip_forward=1 +$ iptables -t nat -A POSTROUTING -o n2n0 -j MASQUERADE +``` + +## Client (192.168.1.45) + +```bash +$ ip route add 192.168.100.0/24 via 192.168.1.23 ``` [1]: https://www.ntop.org/products/n2n/ diff --git a/n2n/arm/Dockerfile b/n2n/arm/Dockerfile index c13bdf3..9929d8c 100644 --- a/n2n/arm/Dockerfile +++ b/n2n/arm/Dockerfile @@ -7,7 +7,7 @@ MAINTAINER EasyPi Software Foundation RUN set -xe \ && apt update \ - && apt install -y gnupg lsb-release net-tools wget \ + && apt install -y gnupg iptables lsb-release net-tools wget \ && wget -qO- http://packages.ntop.org/apt/ntop.key | apt-key add - \ && { \ echo "deb http://apt.ntop.org/stretch_pi armhf/"; \ diff --git a/n2n/arm/docker-compose.yml b/n2n/arm/docker-compose.yml index d934c7d..3f7b542 100644 --- a/n2n/arm/docker-compose.yml +++ b/n2n/arm/docker-compose.yml @@ -1,7 +1,7 @@ edge: image: easypi/n2n-arm entrypoint: ["edge"] - command: ["-dn2n0", "-cmynetwork", "-kmypassword", "-mAA:BB:CC:DD:EE:FF", "-a192.168.100.1", "-p50001", "-lsupernode:7654", "-f"] + command: ["-dn2n0", "-cmynetwork", "-kmypassword", "-mAA:BB:CC:DD:EE:FF", "-a192.168.100.1", "-p50001", "-lsupernode:7654", "-r", "-f"] extra_hosts: - supernode:1.2.3.4 devices: diff --git a/n2n/docker-compose.yml b/n2n/docker-compose.yml index 8d93ee5..6e9e38a 100644 --- a/n2n/docker-compose.yml +++ b/n2n/docker-compose.yml @@ -12,7 +12,7 @@ services: edge: image: vimagick/n2n entrypoint: ["edge"] - command: ["-dn2n0", "-cmynetwork", "-kmypassword", "-mAA:BB:CC:DD:EE:FF", "-a192.168.100.1", "-p50001", "-lsupernode:7654", "-f"] + command: ["-dn2n0", "-cmynetwork", "-kmypassword", "-mAA:BB:CC:DD:EE:FF", "-a192.168.100.1", "-p50001", "-lsupernode:7654", "-r", "-f"] devices: - /dev/net/tun cap_add: