diff --git a/内网穿透工具NPS和NPC部署教程.md b/内网穿透工具NPS和NPC部署教程.md new file mode 100644 index 0000000..7f39f52 --- /dev/null +++ b/内网穿透工具NPS和NPC部署教程.md @@ -0,0 +1,230 @@ +## 官方文档 + +https://ehang-io.github.io/nps + +## 在有公网IP的计算机上安装NPS + +``` +mkdir -p /home/npchome && cd /home/npchome +``` + +#### Linux ARM64 + +``` +wget https://github.com/yisier/nps/releases/download/v0.26.25/linux_arm64_server.tar.gz && tar -zxvf linux_arm64_server.tar.gz +``` + +#### Linux AMD64 + +``` +wget https://github.com/yisier/nps/releases/download/v0.26.25/linux_amd64_server.tar.gz && tar -zxvf linux_amd64_server.tar.gz +``` + +#### Darwin ARM64 + +``` +wget https://github.com/yisier/nps/releases/download/v0.26.25/darwin_arm64_server.tar.gz && tar -zxvf darwin_arm64_server.tar.gz +``` + +#### Darwin AMD64 + +``` +wget https://github.com/yisier/nps/releases/download/v0.26.25/darwin_amd64_server.tar.gz && tar -zxvf darwin_amd64_server.tar.gz +``` + +#### 修改配置文件 + +配置文件参数解析:https://ehang-io.github.io/nps/#/server_config 下面的可以直接改改用: + +``` +vim /home/npchome/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 +``` + +#### 安装命令 + +``` +cd /home/npchome && sudo ./nps install +``` + +#### 启动命令 + +``` +sudo nps start +``` + +#### 停止命令 + +``` +sudo nps stop +``` + +#### 端口号使用情况 + +- 26666:http代理端口 +- 36666:https代理端口 +- 28888:TCP隧道端口 +- 38888:WebUI的端口 +- 48888:TCP隧道开启TLS占用的端口 + +网页端访问地址:http://公网IP:38888 使用示例:https://ehang-io.github.io/nps/#/example 看不懂可以在网上搜:NPS内网穿透使用教程。 + +## 在内网服务器或本地计算机安装npc(Linunx/Mac) + +``` +mkdir -p /home/npchome && cd /home/npchome +``` + +#### Linux ARM64 + +``` +wget https://github.com/yisier/nps/releases/download/v0.26.25/linux_arm64_client.tar.gz && tar -zxvf linux_arm64_client.tar.gz +``` + +#### Linux AMD64 + +``` +wget https://github.com/yisier/nps/releases/download/v0.26.25/linux_amd64_client.tar.gz && tar -zxvf linux_amd64_client.tar.gz +``` + +#### Darwin ARM64 + +``` +wget https://github.com/yisier/nps/releases/download/v0.26.25/darwin_arm64_client.tar.gz && tar -zxvf darwin_arm64_client.tar.gz +``` + +#### Darwin AMD64 + +``` +wget https://github.com/yisier/nps/releases/download/v0.26.25/darwin_amd64_client.tar.gz && tar -zxvf darwin_amd64_client.tar.gz +``` + +#### 安装 +``` +sudo ./npc install -server=安装NPS的机器IP:28888 -vkey=服务端添加客户端生成的key +``` + +#### 启动/停止 +``` +sudo npc start +``` + +``` +sudo npc stop +``` + +## 在Windows上安装npc + +Windows仅支持AMD64,点击这个地址自动开始下载:https://github.com/yisier/nps/releases/download/v0.26.25/windows_amd64_client.tar.gz 下载成功后把压缩包拷贝到一个单独的文件夹,例如在D盘创建一个【NPC】的文件夹,如果你使用的解压软件无法解压,推荐使用`7zip`进行解压。打开命令行窗口,在D:/NPC的目录下执行下面这个命令: + +#### 安装 +``` +npc.exe install -server=安装NPS的机器IP:28888 -vkey=服务端添加客户端生成的key +``` + +#### 启动/停止 +``` +sudo npc start +``` + +``` +sudo npc stop +``` \ No newline at end of file