N2N组建局域网,用于远程调试。
1、服务端配置
我使用的是阿里云的windows服务端,所以下载windos版本的N2N supernode。
注意:1、由于N2N使用的是UDP协议,所以服务端要开启UDP协议出入口
2、配置的supernode端口号,要在服务端的出入口规则中设置为允许。
服务端配置文件supernode.conf如下
# The configuration file is similar to the command line, with one option per line. An equal
# sign '=' should be used between key and value. Example: -p=7777
# This file contains a basic configuration example, please refer to the help (-h) for the full
# list of available options.
#
# -p
# Sets the UDP listening port.
#
-p=7777
#
# -c
# Optionally specifies the allowed communities as listed in community.list file.
#
# -c=community.list
3、执行supernode.exe启动服务
2、windos客户端edge节点
边缘节点有windos平台和ubuntu平台。
- windows平台
由于需要使用的虚拟网卡,因此需要安装openVPN,
并设置虚拟网卡TAP-windows Adapter V9重命名为“net0”
,之后执行edge.exe启动节点 - ubuntu平台
执行 edge edge.conf启动节点 - 配置edge.conf
#
# The configuration file is similar to the command line, with one option per line. An equal
# sign '=' should be used between key and value. Example: -c=mynetwork or --community=mynetwork
# This file contains a basic configuration example, please refer to the help (-h) for the full
# list of available options.
#
# -d|--tun-device
# Specifies the name of the TUN interface.
#虚拟网卡名称
-d=net0
#
# -c|--community
# Specifies the n2n community name the edge belongs to.
#虚拟节点所属组
-c=group
#
# -k
# Sets the encryption key (ASCII). The environment variable N2N_KEY=<key> can also be used.
#虚拟节点所属组密码
-k=pass
#
# -m
# Specified the MAC address for the TAP interface (random otherwise).
#
# -m=DE:AD:BE:EF:99:99
#
# -a
# Sets the interface address. For DHCP use '-r -a dhcp:0.0.0.0'.
#虚拟地址IP
-a=182.22.22.22
#
# -p
# Sets the local UDP port to a fixed port.
#
-p=50001
#
# -l|--supernode-list
# Specifies the supernode IP and port.
#公网IP:端口
-l=*.*.*.*:7777
#