【内网穿透】NPS工具实现内网穿透
官网的简介
服务端安装
下载
github下载服务端和客户端: vps可以wget下载,版本根据实际情况调整
wget https://github.com/ehang-io/nps/releases/download/v0.26.9/linux_amd64_server.tar.gz
解压
tar -zxf linux_amd64_server.tar.gz
解压后目录结构
[root@ecs-ad7b nps]# tree
.
├── conf
│ ├── clients.json
│ ├── hosts.json
│ ├── nps.conf # 需要修改的配置
│ ├── server.key
│ ├── server.pem
│ └── tasks.json
├── linux_386_server.tar.gz
├── nps
└── web
├── static
│ ├── css
│ │ ├── bootstrap.min.css
│ │ ├── bootstrap-table.min.css
│ │ ├── datatables.css
│ │ ├── fontawesome.min.css
│ │ ├── regular.min.css
│ │ ├── solid.min.css
│ │ └── style.css
│ ├── img
│ │ └── flag
│ │ ├── en-US.png
│ │ └── zh-CN.png
│ ├── js
│ │ ├── bootstrap.min.js
│ │ ├── bootstrap-table-locale-all.min.js
│ │ ├── bootstrap-table.min.js
│ │ ├── echarts.min.js
│ │ ├── fontawesome.min.js
│ │ ├── inspinia.js
│ │ ├── jquery-3.4.1.min.js
│ │ ├── language.js
│ │ └── popper.min.js
│ ├── page
│ │ ├── error.html
│ │ └── languages.xml
│ └── webfonts
│ ├── fa-solid-900.eot
│ ├── fa-solid-900.svg
│ ├── fa-solid-900.ttf
│ ├── fa-solid-900.woff
│ └── fa-solid-900.woff2
└── views
├── client
│ ├── add.html
│ ├── edit.html
│ └── list.html
├── index
│ ├── add.html
│ ├── edit.html
│ ├── hadd.html
│ ├── hedit.html
│ ├── help.html
│ ├── hlist.html
│ ├── index.html
│ └── list.html
├── login
│ ├── index.html
│ └── register.html
└── public
├── error.html
└── layout.html
14 directories, 48 files
修改配置
修改配置文件:端口、后台管理账号、后台管理密码
#HTTP(S)代理端口 http_proxy_ip=0.0.0.0 http_proxy_port=80 https_proxy_port=443 https_just_proxy=true #bridge bridge_type=tcp bridge_port=8024 #默认客户端连接服务器端的桥接口,可修改 bridge_ip=0.0.0.0 #公用的客户端连接服务端密钥,可修改 public_vkey=123 #web后台管理 web_host=a.o.com web_username=admin #默认用户名,修改 web_password=123 #默认密码,修改 web_port = 8080 #默认web端口 web_ip=0.0.0.0 web_base_url= #可设置web路径例如:web_base_url=/nps web_open_ssl=false web_cert_file=conf/server.pem web_key_file=conf/server.key #auth_key, web api认证ip密钥,可修改,必须16位! auth_crypt_key =1234567812345678
部署
修改完配置文件之后, ./nps install 当前的配置文件和web静态文件拷贝到/etc/nps下,以后修改配置文件直接修改/etc/nps/conf/nps.conf
启动服务
nps start
后台管理
浏览器登录web管理面板: http://your_ip:8080/
创建客户端
新增客户端
客户端执行
然后在本机下载客户端,windows为例: win+r运行cmd,进入到该目录(填你自己解压的目录):
npc.exe -server=ip:port -vkey=xxxxx
这里的ip是你服务器ip 端口是你nps.conf中#bridge设置的桥接端口 -vkey是你控制面板客户端生成的唯一认证密钥
socks测试
至此内网穿透已经成功了,然后我们可以选择Advanced高级设置选择设置服务名称,我设置为test。 在设置规则:
