中文 English

Compiling N2N Components SuperNode and Edge on Mac

Published: 2021-11-09

Reference: https://www.jianshu.com/p/5021b70c3ff9

Installing Required Software with Brew

brew install openssl
brew tap homebrew/cask
brew install --cask tuntap

Tip: If the command line reports that installation of tuntap failed, go to System Settings, select Security & Privacy, and choose Allow

Clone and Compile from GitHub

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

Copy Edge to /usr/local/bin/edge and Grant Executable Permission

cp edge /usr/local/bin/
chmod +x /usr/local/bin/edge

Test if It Starts Normally

./edge -a 10.0.0.1 -c EfIvHDDSWEW3QM -k EfIvHDDSWEW3QM -l 127.0.0.1:2345 -v -f
sudo edge -a 10.0.0.10 -c EfIvHDDSWEW3QM -k EfIvHDDSWEW3QM -l blog.margrop.net:2345 -v -f

edgesh.sh

#/bin/bash
ps -e | grep "edge -a" | awk '{print $1}' | xargs sudo kill
sudo edge -a 10.0.0.1 -c MAC -k EfIvHDDSWEW3QM -l blog.margrop.net:2345-v -r

sudo route -v delete -net 192.168.1.0 -gateway 10.0.0.1
sudo route -v delete -net 192.168.2.0 -gateway 10.0.0.2

sudo route -n add -net 192.168.1.0 -netmask 255.255.255.0 10.0.0.1
sudo route -n add -net 192.168.2.0 -netmask 255.255.255.0 10.0.0.2
ping 192.168.1.1 -c 3
ping 192.168.2.1 -c 3
ping 10.0.0.1 -c 3