nps与npc内网穿透搭建教程

1.简介

nps是一款轻量级、高性能、功能强大的内网穿透代理服务器。目前支持tcp、udp流量转发,可支持任何tcp、udp上层协议,支持内网http代理、内网socks5代理、p2p等,并带有功能强大的web管理端

使用内网穿透技术可以使你在公共网络环境也能轻松连接你的内网设备,除了之前介绍过的frp之后,此款NPS也是比较推荐的,通过Web管理的方式快速地创建和管理穿透设备。

官网:https://ehang-io.github.io/nps/#/
项目:https://github.com/ehang-io/nps
版本:https://github.com/ehang-io/nps/releases
docker:https://hub.docker.com/r/ffdfgdfg/npc

基本环境要求:需要一台有公网ip的云主机,即需要购买一台云主机

2.1创建目录

mkdir -p /opt/nps
mkdir -p /opt/npc

2.2 安装nps

cd /opt/nps
#下载
wget https://github.com/ehang-io/nps/releases/download/v0.26.10/linux_amd64_server.tar.gz
#解压
tar -xvf linux_amd64_server.tar.gz
chomd 775 nps
# 安装
./nps install
./nps start

访问nps服务

http://192.168.10.86:8080/

2.2 安装npc

cd /opt/npc
#下载
wget https://github.com/ehang-io/nps/releases/download/v0.26.10/linux_amd64_client.tar.gz
#解压
tar -xvf linux_amd64_client.tar.gz
chomd 775 npc
# 安装
./npc install

npc.conf

[common]
server_addr=43.133.208.126:8024
conn_type=tcp
vkey=sibq1ivg0ejv4b7f
auto_reconnection=true
max_conn=1000
flow_limit=1000
rate_limit=1000
basic_username=11
basic_password=3
web_username=user
web_password=1234
crypt=true
compress=true
#pprof_addr=0.0.0.0:9999
disconnect_timeout=60

或用docker安装NPC客户端:

docker run -d --name npc --net=host -v /opt/npc:/conf yisier1/npc -config=/conf/npc.conf

客户端已配置好的文件 :npc_ZK6rF.tar.gz 

3. 配置内网穿透通道

  • 新增客户端

直接点击确定

需要点击一下刷新按钮才能显示新增的客户端列表

  • 新增通道

服务端端口目标 (IP:端口) 一定要填写正确。

4.启动npc内网穿透代理

点击客户端菜单,然后点击如图对应的客户端+号;等到

./npc -server=192.168.10.86:8024 -vkey=z939xcweszod7c5b -type=tcp

如何使用的云主机对应192.168.10.86这个ip应该为公网的ip

在安装了npc 客户端的内网服务执行如下命令

./npc -server=192.168.10.86:8024 -vkey=z939xcweszod7c5b -type=tcp

执行后,如下图说明成功