未分类 · 2023年3月24日 0

nps反向代理快速搭建【】

本例以windows10(ip:192.168.244.1)、vmware中一台centos(ip:192.168.244.132)演示

  • 服务端(windows10)

    1. 下载server,并解压,历史版本请参见github
    2. 以管理员身份运行cmd,切换到server目录下,执行nps.exe installnps.exe start,访问默认webip:8080,默认用户密码:admin/123
    D:windows_amd64_serverwindows_amd64_server>nps.exe install
    D:windows_amd64_serverwindows_amd64_server>nps.exe start
    
    登录
    1. 新增客户端,并配置隧道
      3.1 新增客户端,生成密钥(后续client端启动需要通过该密钥认证)

      01

      02

      03

      3.2 配置隧道(docker容器ip获取命令:docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id)

      01

      02

      03
  • 客户端(以vmware中一台centos7为例)

    1. 下载client包,并解压,各历史版本请参见github
    [root@mhy ~]# wget https://github.com/ehang-io/nps/releases/download/v0.26.10/linux_amd64_client.tar.gz
    [root@mhy ~]# tar xvf linux_amd64_client.tar.gz -C ./nps
    
    1. 运行以下命令启动客户端
     [root@mhy ~]# cd nps
     [root@mhy nps]# ./npc --server=192.168.244.1:8024 --vkey=dz3ojlv2s69aj77u # vkey为web页面配置客户端时生成的密钥
    2022/05/23 22:31:44.878 [I] [npc.go:231]  the version of client is 0.26.10, the core version of client is 0.26.0
    2022/05/23 22:31:44.879 [I] [client.go:72]  Successful connection with server 192.168.244.1:8024
    
  • 结果

    1. 查看web客户端运行状态

      客户端显示连接
    2. 内网配置状态
      image.png

      3.手机(手机与电脑处于同一局域网)访问PChttp://192.168.244.1:8003将映射到centos7内部的docker:3000端口(服务为grafana),注意,是映射到docker容器的3000端口!!!:http://192.168.1.3:8003/d/aka/1-node-exporter-dashboard-22-04-13-consulmanagerzi-dong-tong-bu-ban?orgId=1

      成功
打赏 赞(0) 分享'
分享到...
微信
支付宝
微信二维码图片

微信扫描二维码打赏

支付宝二维码图片

支付宝扫描二维码打赏