当前位置:   article > 正文

如何通过n2n实现内网穿透,在外面也能访问家里的电脑_n2n内网穿透

n2n内网穿透

GitHub - ntop/n2n: 点对点 VPN

推荐:

1 下载n2n并解压到/usr/local/n2n
2 创建supernode配置文件/usr/local/n2n/supernode.conf
3 创建edge配置文件 /usr/local/n2n/edge.conf
4 创建supernode服务 /etc/systemd/system/supernode.service或者/usr/lib/systemd/system/supernode.service
5 设置supernode开机启动 systemctl enable supernode --now
6 设置edge开机启动 systemctl enable edge --now

supernode部署

直接下载:

https://github.com/lucktu/n2n.git

源码编译:

  1. ./autogen.sh
  2. ./configure
  3. make
  4. # optionally install
  5. make install

配置服务:

  1. vi /etc/n2n/supernode.conf # 配置文件
  2. -p 2345

服务:

/etc/systemd/system/supernode.service

  1. [Unit]
  2. Description=N2N SuperNode Run On Port 2012 UDP
  3. After=network.target
  4. [Service]
  5. Type=simple
  6. ExecStart=/usr/sbin/supernode /etc/n2n/supernode.conf -f
  7. TimeoutStartSec=0
  8. [Install]
  9. WantedBy=default.target

edge

windows可能需要安装https://build.openvpn.net/downloads/releases/tap-windows-9.21.0.exe

/usr/local/n2n/edge -c mynetwork -k mysecretpass -a 192.168.100.5 -l 124.221.191.89:2345

服务:

  1. cat > /etc/systemd/system/edge.service << END
  2. [Unit]
  3. Description=n2n edge
  4. Wants=network-online.target
  5. After=network-online.target
  6. [Service]
  7. ExecStartPre=/bin/sh -c 'until ping -c1 124.221.191.89; do sleep 1; done;'
  8. ExecStart=/usr/local/n2n/edge /usr/local/n2n/edge.conf -f
  9. [Install]
  10. WantedBy=multi-user.target
  11. END

配置文件:

  1. $ vi /usr/local/n2n/edge.conf
  2. -c=mynetwork
  3. -k=mysecretpass
  4. -a=192.168.100.5
  5. -l=124.221.191.89:2345

原文章:如何通过n2n实现内网穿透,在外面也能访问家里的电脑 - 汇思班

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/码创造者/article/detail/943537
推荐阅读
相关标签
  

闽ICP备14008679号