n2n在MacOS Big Sur(11.4)系统中编译

n2n在MacOS Big Sur(11.4)系统中编译

1. 下载源码

git clone -b 3.0-stable  https://github.com/ntop/n2n.git n2n 

2. 安装工具

工具使用brew安装,如果没有brew 参考:https://brew.sh/index_zh-cn

brew install --cask  tuntap
如果遇到以下错误:
installer: The install failed. (安装器遇到了一个错误,导致安装失败。请联系软件生产企业以获得帮助。 运行软件包“tuntap_20150118.pkg”的脚本时出错。)
==> Purging files for version 20150118 of Cask tuntap
Error: Failure while executing; `/usr/bin/sudo -E -- /usr/bin/env LOGNAME=mac USER=mac USERNAME=mac /usr/sbin/installer -pkg /usr/local/Caskroom/tuntap/20150118/tuntap_20150118.pkg -target /` exited with 1. Here's the output:
installer: Package name is TunTap Installer package
installer: Installing at base path /
installer: The install failed. (安装器遇到了一个错误,导致安装失败。请联系软件生产企业以获得帮助。 运行软件包“tuntap_20150118.pkg”的脚本时出错。)
请前往系统偏好设置->安全与隐私->允许从以下位置下载的App,选择任何源,有可能需要重启系统,根据系统提示操作!然后重新安装tuntap
brew install openssl
brew install cmake 

3. 编译n2n

$ cd n2n
$ mkdir build
$ cd build
$ cmake ..

$ sudo make install
如果出现以下错误:
/usr/local/Cellar/cmake/3.21.3_1/bin/cmake -P cmake_install.cmake
-- Install configuration: ""
-- Installing: /usr/local/sbin/edge
-- Installing: /usr/local/sbin/supernode
-- Installing: /usr/local/bin/n2n-decode
-- Installing: /usr/local/bin/n2n-benchmark
CMake Error at cmake_install.cmake:89 (file):
  file cannot create directory: /usr/share/man8.  Maybe need administrative
  privileges.
make: *** [install] Error 1
#需要手动将cmake_install.cmake 文件中的/usr/share/替换为/usr/local/share/
$ sudo chmod -R 777 /usr/local/sbin

$ export PATH=$PATH:/usr/local/sbin 

4. 安装成功

$ edge -h

Welcome to n2n v.3.0.0.r1041.0177e14 for Darwin
Built on Nov 17 2021 11:25:13
Copyright 2007-2021 - ntop.org and contributors

 general usage:  edge <config file> (see edge.conf)

            or   edge  -c <community name> -l <supernode host:port>
                      [-p [<local bind ip address>:]<local port>] 
                      
 options for under-   [-i <registration interval>] [-L <registration ttl>] 
 lying connection     [-k <key>] [-A<cipher>] [-H] [-z<compression>] 
                      [-e <preferred local IP address>] [-S<level of solitude>]
                      [--select-rtt]

 tap device and       [-a [static:|dhcp:]<tap IP address>[/<cidr suffix>]] 
 overlay network      [-m <tap MAC address>] 
 configuration        [-M <tap MTU>] [-r] [-E] [-I <edge description>] 
                      [-J <password>] [-P <public key>] [-R <rule string>] 

 local options        [-f] [-t <management port>] [--management-password <pw>] 
                      [-v] [-n <cidr:gateway>] 
                      [-u <numerical user id>] [-g <numerical group id>] 

 environment          N2N_KEY         instead of [-k <key>]
 variables            N2N_COMMUNITY   instead of -c <community>
                      N2N_PASSWORD    instead of [-J <password>]
                      
 meaning of the       
 flag options         [-H]  enable header encryption
                      [-r]  enable packet forwarding through n2n community
                      [-E]  accept multicast MAC addresses
            [--select-rtt]  select supernode by round trip time
            [--select-mac]  select supernode by MAC address
                      [-f]  do not fork but run in foreground
                      [-v]  make more verbose, repeat as required
                      
  -h    shows this quick reference including all available options
 --help gives a detailed parameter description
   man  files for n2n, edge, and superndode contain in-depth information

5. 客户端配置

supernode.ml 提供了公开N2N中心节点http://www.supernode.ml/

A设备启动
sudo edge -l supernode.ntop.org:7777 -c n2n0 -a 172.168.3.2 -k 5tgb6yhn7ujm -f
B设备启动
sudo edge -l supernode.ntop.org:7777 -c n2n0 -a 172.168.3.1 -k 5tgb6yhn7ujm -f 

基本组网完成

6. 参考资料

参考链接:macos Catalina 10.15 安装n2n

N2N 编译说明文档:https://github.com/meyerd/n2n/wiki

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值