nps内网穿透教程

小五四丫

文章最后更新时间:2024年02月15日

nps开源地址:https://github.com/ehang-io/nps/releases

一、安装nps服务端

1、服务器是amd的就下载这个

wget https://github.com/ehang-io/nps/releases/download/v0.26.10/linux_amd64_server.tar.gz

2、解压nps

tar -zxvf linux_amd64_server.tar.gz

3、安装nps

nps install

二、配置文件

1、打开配置文件

vi /etc/nps/conf/nps.conf

2、修改路径下/conf/nps.conf文件

appname = nps
#Boot mode(dev|pro)
runmode = dev

#HTTP(S) proxy port, no startup if empty
http_proxy_ip=0.0.0.0
http_proxy_port=80     #更改端口
https_proxy_port=443    #更改端口
https_just_proxy=true
#default https certificate setting
https_default_cert_file=conf/server.pem
https_default_key_file=conf/server.key

##bridge
bridge_type=tcp
bridge_port=8024
bridge_ip=0.0.0.0

# Public password, which clients can use to connect to the server
# After the connection, the server will be able to open relevant ports and parse related domain names according to its own configuration file.
public_vkey=123

#Traffic data persistence interval(minute)
#Ignorance means no persistence
#flow_store_interval=1

# log level LevelEmergency->0  LevelAlert->1 LevelCritical->2 LevelError->3 LevelWarning->4 LevelNotice->5 LevelInformational->6 LevelDebug->7
log_level=7
#log_path=nps.log

#Whether to restrict IP access, true or false or ignore
#ip_limit=true

#p2p
#p2p_ip=127.0.0.1
#p2p_port=6000

#web
web_host=a.o.com    #绑定nps面板域名改这里
web_username=admin  #修改用户名
web_password=123    #修改密码  
web_port = 8080     #后台端口
web_ip=0.0.0.0
web_base_url=
web_open_ssl=false
web_cert_file=conf/server.pem
web_key_file=conf/server.key
# if web under proxy use sub path. like http://host/nps need this.
#web_base_url=/nps

#Web API unauthenticated IP address(the len of auth_crypt_key must be 16)
#Remove comments if needed
#auth_key=test                      #随便修改一下
auth_crypt_key =1234567812345678    #随便修改一下

#allow_ports=9001-9009,10001,11000-12000

#Web management multi-user login
allow_user_login=false
allow_user_register=false
allow_user_change_username=false


#extension
allow_flow_limit=false
allow_rate_limit=false
allow_tunnel_num_limit=false
allow_local_proxy=false
allow_connection_num_limit=false
allow_multi_ip=false
system_info_display=false

#cache
http_cache=false
http_cache_length=100

#get origin ip
http_add_origin_header=false

#pprof debug options
#pprof_ip=0.0.0.0
#pprof_port=9999

#client disconnect timeout
disconnect_timeout=60

3、重启nps

nps restart

4、如果没有更改8024端口记得开启防火墙才能打开nps面板

三、添加客户端

1、服务器ip:8080如果更改端口就输入你更改的端口

2、输入你更改后的账号密码

3、打开客户端,新增

备注(随便填)---Basic 认证用户名(可填可不填)---Basic 认证密码(可填可不填)----唯一验证密钥(不填会自动生成)---允许客户端通过配置文件连接(这里建议选否)---压缩()---加密(

然后点击新增,然后刷新一下会显示

4、点击创建的客户端然后找到创建的客户端左边有一个+号,点一下

然后复制客户端命令

四、安装本地设备客户端

1、下载客户端名字带有client就是客户端,这个根据你本地型号来定

1)amd64下载命令

wget https://github.com/ehang-io/nps/releases/download/v0.26.10/linux_amd64_client.tar.gz

2)arm64下载命令

wget https://github.com/ehang-io/nps/releases/download/v0.26.10/linux_arm64_client.tar.gz

3)Windows下载链接

https://github.com/ehang-io/nps/releases/download/v0.26.10/windows_amd64_client.tar.gz

4)docker拉库链接,后面的ip和密钥需要修改后再拉库

docker run -d --name npc --net=host ffdfgdfg/npc -server=127.0.0.1:8024 -vkey=123456 -type=tcp

2、解压nps

使用cd命令访问到下载目录

解压命令amd64

tar -zxvf linux_amd64_client.tar.gz

解压命令arm64

tar -zxvf linux_arm64_client.tar.gz

Windows用解压软件解压

3、运行npc

修改你的客户端命令,只需要在npc后面添加install即可,例如

./npc install -server=www.baidu.com:8024 -vkey=123456 -type=tcp

4、启动npc

npc start

然后打开nps找到客户端查看你的客户端是否显示在线

5、如需要添加自启就找到文件/etc/rc.local文件

下面放如上面输入的代码即可

./npc install -server=127.0.0.1:8024 -vkey=123456 -type=tcp

五、创建内网穿透端口

1、找到你的客户端,点击隧道

2、点击新增

模式(如果穿透端口就选择tcp隧道)---客户端ID(默认不用改)---备注(随便填)---服务器端口(穿透后访问的端口)---目标 (IP:端口)(内网要穿透的ip+端口

然后点击保存


 您阅读本篇文章共花了: 

文章版权声明

1、本网站名字:小五四博客

2、本网站地址:https://blog.xiao54.com/

3、如发现链接失效,请联系我们我们会第一时间更新。

4、本站提供的一切软件、教程和内容信息仅限用于学习和研究目的,不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。

5、本站信息来自网络收集整理,版权争议与本站无关。您必须在下载后的24小时之内,从您的电脑或手机中彻底删除上述内容。

6、如果您喜欢该程序和内容,请支持正版,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。敬请谅解!转载或复制请以超链接形式并注明出处。

您需要 登录账户 后才能发表评论

发表评论

快捷回复: 表情:
AddoilApplauseBadlaughBombCoffeeFabulousFacepalmFecesFrownHeyhaInsidiousKeepFightingNoProbPigHeadShockedSinistersmileSlapSocialSweatTolaughWatermelonWittyWowYeahYellowdog
验证码
评论列表 (暂无评论,1182人围观)

还没有评论,来说两句吧...

目录[+]