jupyter notebook remote access to the intranet server

1. Background

I have done FRP intranet penetration and directly connected to the campus server before, but the effect is not very good for various reasons. (The high probability is that there is a router short, because the server will be indirectly disconnected from the campus network). Therefore, the internal network server cannot connect to the external network, only the internal network ip.
All I have to do is to remotely connect to the intranet server from Jupyter on the external network
. Thank you for your advice.

2. Preparation

In addition to the remote server and your personal computer, you also need a computer (called a springboard server) that can access the Internet on the intranet and a cloud server.
Need to use:

1.frp intranet penetration
2.jupyter notebook remote connection
3.xshell

3 process

The first step : The springboard server connects to jupyter on the server. Reference article
(if you are in school, you only need to do this step)
You can run jupyter notebook in the background

nohup jupyter notebook &

The second step : FRP intranet penetration, you can also use ssh to connect to the campus computer at home.
There are a lot of frp tutorials, so please search directly. (Pay attention to whether the port is open) A Chinese document with the source address of frp is attached .
Step 3:
Now you can connect to the springboard server on the external network (referring to the computer that can connect to the internal network and the external network), and the springboard server can connect to the jupyter server. What we have to do is to directly connect to the internal network server on the external network.
Here is the ssh tunnel forward proxy port forwarding (I don’t know the details, please forgive me if I made a mistake)
On a personal computer, first connect to the springboard server through xshell, and then enter

ssh -L port:服务器ip:jupyter连接port user@服务器ip

Insert picture description here
Enter the above command on the springboard server you are connected to. The 18954 port is the port you entered on the personal computer browser (not necessarily 18954, but pay attention to whether the port of the cloud server is open). 10.*.86.54 is the server (only internal network ip, no external network ip) 8888 port is the port opened by Jupyter, if you don't want to use this, you can set it on the server. The user@ip at the back is your username on the server and the server ip.
After entering the password, you can connect to the server. (If you want to operate directly on the command line, you don't need to read the following)
Step 4 :
This is related to xshell. I haven't tried putty.
Principle: Port forwarding (please forgive me if you make a mistake).
Insert picture description here
After referring to this article on using xshell, I found out that there is still a port forwarding reference article.
In the above tutorial ( link
) on how to connect to jupyter in the intranet, xshell is not used, but in this article, it is used xshell.

Step 5 :
You can directly open 127.0.0.1:18964 in the browser to enter the server's jupyter. Of course, enter the login password. The password set in the first step.
Insert picture description here
In addition to paying attention to whether the port is turned on, there is also whether the computer sshd with
frpc is turned on is really super easy to use, I love it.

Extension: The internal network server is not connected to the external network, but through port forwarding, port mapping, and reverse proxy, you can use the network pip install package. I haven't tried this yet.

Guess you like

Origin blog.csdn.net/qq_38469784/article/details/105827509