• 网站更换域名啦!烦请各位及时更新哦,旧域名将在一定时间后不可访问
  • 网站所有加密内容密码一律为:xzxz.me;别问为什么,问就是为了活着
  • 现已回国安心恢复身体,感谢所有在闭站期间仍然支持我的人,从零开始,继续努力
  • 订阅小站 TG频道获取更多小福利
  • 欢迎访问小站,如果您觉得本站还不错,请Ctrl+D 收藏本站
  • 请不要催更视频或文章;网站+所有视频制作都是我一人再弄,而且懒;你们多多留言,我可能就会破天荒更新了
  • 任何虚假邮箱的留言评论将一律不通过,你的邮箱不会被公开,请放心留言交流
  • 网站今后如果无法访问,请自行使用代理访问

NPS内网穿透-轻量级、全可视化操作、告别手敲代码 | How to install and penetrate intranet using NPS

Tech CrazyJoe 6个月前 (03-30) 1179次浏览 0个评论
本文最后更新于2020年3月31日,已超过 176天没有更新,如果文章内容或资源失效,请留言反馈,谢谢!

NPS内网穿透-轻量级、全可视化操作、告别手敲代码 | How to install and penetrate intranet using NPS

Before we start

In order to follow this guide, I assume you already have a VPS and facing an intranet situation which you can’t expose a port to the public. If you have extranets, DDNS is more suitable for you.

I will use a Ubuntu 18.04 machine for this guide. The command line will differ among different machine types. Make sure you fully aware of that. So, Let’s dive right in.

Install NPS

Use any of your favorable SSH clients to connect to the VPS, Then follow the command below:

## First create a folder for your nps service

mkdir nps

## cd to that directory

cd nps

## pull the nps file (in this guide, I will use amd64 version of nps, please choose the suitable one for your own machine)

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

## untar the file

tar -xvf linux_amd64_server.tar.gz

## see the relevant files

ls

## install the nps

sudo ./nps install

## navigate to the nps config file folder

cd /etc/nps

## modify the config setting to suit your need

nano conf/nps.conf

## start the nps

sudo nps start

## access the dashboard

Access server IP:web service port (default is 8080).

Login with username and password (default is admin/123, must be modified when officially used).

Connect a client

Create a client on the NPS portal. I will demonstrate how to connect to my home router and NAS in this example.

First, choose the client on the left panel, then choose a remark for your client. You can leave all the other fields blank, click Add when you finished.

NPS内网穿透-轻量级、全可视化操作、告别手敲代码 | How to install and penetrate intranet using NPS

Login to your router and input your server ip, port, and vkey, then connect to the NPS (It’s highly recommend to put this kind of service on your primary router).

NPS内网穿透-轻量级、全可视化操作、告别手敲代码 | How to install and penetrate intranet using NPS

Create a TCP profile to connect to your home router. In this example, I use server IP:9000 to access my home router address as 192.168.123.1:80.

NPS内网穿透-轻量级、全可视化操作、告别手敲代码 | How to install and penetrate intranet using NPS


Docker Way

You can also install NPS as Docker image, the docker way is describe below.

Install Docker on VPS

First, Use any of your favorable SSH clients to connect to the VPS, Then follow the command below:

The following command is used for CentOS only.

## this will update your system packages

sudo yum update

## this will install the required dependencies

sudo yum install yum-utils device-mapper-persistent-data lvm2

## add the <a href="https://www.xzxz.me/tag/docker/" title="查看更多关于Docker的文章" target="_blank">Docker</a> stable repository to your system:

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

## install the latest version of <a href="https://www.xzxz.me/tag/docker/" title="查看更多关于Docker的文章" target="_blank">Docker</a> CE

sudo yum install docker-ce

## start the <a href="https://www.xzxz.me/tag/docker/" title="查看更多关于Docker的文章" target="_blank">Docker</a> daemon and enable it to automatically start at boot time

sudo systemctl start docker

sudo systemctl enable docker

## verify that the <a href="https://www.xzxz.me/tag/docker/" title="查看更多关于Docker的文章" target="_blank">Docker</a> service is running

sudo systemctl status docker

## check the Docker version

docker -v

Now, the Docker should be installed and running on your machine. But by default managing, Docker requires administrator privileges. If you want to run Docker commands as a non-root user without prepending sudo you need to add your user to the docker group which is created during the installation of the Docker CE package. You can do that by typing:

sudo usermod -aG docker $USER

Log out and log back in so that the group membership is refreshed. Then you should be able to run docker commands without sudo. Now, let’s test it by typing:

docker container run hello-world

If you get the message like below, you’re good to go:

Unable to find image ‘hello-world:latest’ locally

latest: Pulling from library/hello-world

9bb5a5d4561a: Pull complete

Digest: sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77

Status: Downloaded newer image for hello-world:latest

Hello from Docker!

This message shows that your installation appears to be working correctly.

Install NPS to the Docker

docker pull ffdfgdfg/nps

You can manage your Docker image better with GUI interface by using Portainer. This is optional, but I will install Portainer in this case.

docker volume create portainer_data

docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

Now, you can access Portainer dashboard by entering your VPS IP:9000, you will create an administrator account when you first login. Choose local to connect with your Docker. Then you can check the NPS image you just pulled by going to the images tab.

Modify the Conf file

Download the NPS conf folder here, then modify the nps.conf file.

web_username=admin

web_password=123

You can change your login information by changing the above parameter.

Once you’re done, you can upload the conf folder to your VPS directory.

Start NPS

docker run -d –name nps –net=host -v <your vps conf folder directory>:/conf ffdfgdfg/nps

Like in this tutorial, I upload the conf folder to the /home/centos folder, then <my vps conf folder directory> will be /home/centos/conf

Once the nps started, you can access the web panel by entering your VPS IP:8080.

Now, you can config and connect your client here.


中文教程由此开始

开始之前

为了参照此教程,我默认你已经有了一台VPS服务器并且面临内网环境,无法开放端口给外网访问。如果你有公网IP,DDNS更适合你。

在此教程中我使用Ubuntu 18.04系统为例。相关命令可能在不同系统上略有不同,请确保悉知这一点。那让我们正式开始。

安装NPS

使用你喜欢的任意SSH客户端连接VPS,之后参照以下命令

## 首选创建一个nps文件夹

mkdir nps

## cd到这个目录

cd nps

## 拉取nps镜像(在此教程中我拉取的是amd64架构,请根据你服务器实际架构选择,一般都是amd64)

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

## 解压相关文件

tar -xvf linux_amd64_server.tar.gz

## 查看解压后的文件

ls

## 安装nps

sudo ./nps install

## cd到nps配置文件夹

cd /etc/nps

## 按需修改nps的配置文件

nano conf/nps.conf

## 开启nps

sudo nps start

## 登录nps后台

Access server IP:web service port (default is 8080).

使用用户名及密码登录,默认的用户是admin,密码是123.

连接客户端

NPS后台创建一个客户端,我将演示如何连接到自己家中的路由器和NAS。

首选我们在左边选择客户端,做好备注名,点击添加(其余选择均可留空)

NPS内网穿透-轻量级、全可视化操作、告别手敲代码 | How to install and penetrate intranet using NPS

登录你的路由器后台,填入nps后台创建的客户端相关信息,即服务器ip,端口和密钥。(强烈建议将内网穿透等服务放置在自己的主路由上)

NPS内网穿透-轻量级、全可视化操作、告别手敲代码 | How to install and penetrate intranet using NPS

创建一个TCP配置去连接家中的路由器。此例中的设置将使用服务器ip:9000端口访问家用的内网路由器地址192.168.123.1:80端口

NPS内网穿透-轻量级、全可视化操作、告别手敲代码 | How to install and penetrate intranet using NPS

Video Tutorial | 视频教程:

Youtube

Bilibili

0 0 vote
Article Rating

xzの小站 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:NPS内网穿透-轻量级、全可视化操作、告别手敲代码 | How to install and penetrate intranet using NPS
喜欢 (2)
关于作者:
Is life always this hard, or is it just when you're a kid?——Mathilda:Léon: The Professional
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x