默认分类

使用N2Nv3搭建异地局域网

从Github下载最新版本n2nv3

git clone https://github.com/ntop/n2n.git

编译x64和静态交叉编译arm架构ELF

vps服务器n2n编译
cd n2n
./autogen.sh 
./configure 
make &&make install

静态交叉编译arm
apt install gcc-arm-linux-gnueabi #安装交叉编译器
make clean #清理之前的编译内容,不然会交叉编译失败
./configure --host=arm-linux-gnueabi LDFLAGS=-static CC=arm-linux-gnueabi-gcc #定义静态编译参数LDFLAGS=-static ,指定CC交叉编译器arm-linux-gnueabi-gcc 
make
file edge
edge: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, BuildID[sha1]=d6c347797ffa748ffc11f73c9ed5a0d474301ceb, for GNU/Linux 3.2.0, with debug_info, not stripped
./

服务器运行超级节点

supernode -M -p 9999 #使用端口9999,注意vps控制面板开放9999端口

服务器运行edge客户端和开启ip转发

edge -c 5566778899 -l 47.242.91.127:9999 -a 192.168.22.44 -r
 -c 指定小组名称为5566778899,-a 使用静态ip地址192.168.22.44, -r 允许ip转发
sysctl -w net.ipv4.ip_forward=1 #打开内核ip转发
iptables -F #清除防火墙入站规则,可能有入站拦截
iptables -P FORWARD ACCEPT #转发规则默认允许
iptables -t nat -I POSTROUTING -j MASQUERADE -o eth0 #使用iptables 添加流量伪装

windows edge客户端加入小组,并添加服务器ip 192.168.22.44为默认网关

使用easyn2n https://bugxia.com/357.html
edge.exe -c 5566778899 -l 47.242.91.127:9999 -a 192.168.22.77 #加入小组

添加192.168.22.44为默认网关
route delete 47.242.91.117  
route add 47.242.91.117 mask 255.255.255.255 192.168.2.1 metric 1 if 16  #添加vps服务器ip路由为本地网关
route delete 0.0.0.0
route add 0.0.0.0 mask 0.0.0.0 192.168.22.44 #设置默认网关为192.168.22.44

openwrt 路由器加入小组,并实现连入wifi全局FQ

将交叉编译好的 edge elf文件复制到路由器
edge -c 556677889911 -l 47.242.91.127:9999 -a 192.168.22.55 #加入小组
ip route add 47.242.91.117 via 192.168.2.1 #添加vps服务器ip路由为本地网关
ip route del default #删除默认网关
ip route add default via 192.168.22.44 #设置默认网关为192.168.22.44

回复

This is just a placeholder img.