Files
linux/内网穿透工具.md

136 lines
2.8 KiB
Markdown
Raw Normal View History

2026-04-16 10:12:27 +08:00
# 文档
- 原作者https://ehang-io.github.io/nps
- 维护者https://my.feishu.cn/wiki/FmVVwDcEGiTZxekYJl5ccuFanlg
- Githubhttps://github.com/yisier/nps/releases
## 服务端
下载`linux_amd64_server.tar.gz`压缩包并解压,然后执行`sudo ./nps install`安装。修改配置文件:
```
nano /etc/nps/conf/nps.conf
```
```
# 自定义,英文+数字不超过16位
public_vkey=
# 自定义,英文+数字不超过16位
auth_key=
# 自定义,英文+数字固定16位
auth_crypt_key=
# 网页端管理员用户名
web_username=admin
# 网页端管理员账号的密码,英文+数字+特殊符号(.@!
web_password=
appname = nps
#Boot mode(dev|pro)
runmode = pro
#HTTP(S) proxy port, no startup if empty
http_proxy_ip=0.0.0.0
http_proxy_port=26666
https_proxy_port=36666
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=28888
bridge_ip=0.0.0.0
#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=6
log_path=nps.log
#p2p
#p2p_ip=127.0.0.1
#p2p_port=6000
#web
web_host=a.o.com
web_port = 38888
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
#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=true
#带宽限制
allow_rate_limit=true
#客户端最大隧道数限制
allow_tunnel_num_limit=true
allow_local_proxy=false
#客户端最大连接数
allow_connection_num_limit=true
#每个隧道监听不同的服务端端口
allow_multi_ip=true
system_info_display=true
#获取用户真实ip
http_add_origin_header=true
#cache
http_cache=false
http_cache_length=10
#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
#管理面板开启验证码校验
open_captcha=false
# 是否开启tls
tls_enable=true
tls_bridge_port=48888
```
修改完成后,执行`sudo nps start`启动服务端。
| 端口号 | 用途 |
|:-----|:-----|
| 26666 | http代理端口 |
| 36666 | https代理端口 |
| 28888 | TCP隧道端口 |
| 38888 | WebUI的端口 |
| 48888 | TCP隧道 TLS 端口 |
## 客户端
下载`linux_amd64_client.tar.gz`压缩包并解压
```
# 安装
sudo ./npc install -server=服务端IP:28888 -vkey=<vkey>
# 启动
sudo npc start
# 停止
sudo npc stop
```