Vscode port forwarding realizes port mapping and realizes port freedom

It is very convenient to use vscode to connect to the server for development, but in many cases, the port opening of the server is very limited, so you can use vscode for port mapping

 

Give an application scenario:

First use vscode to connect to B through A, and then perform port forwarding in the port window of vscode, for example, map port 22 to A’s local 5000, then use vscode to connect to A through Host, and use port forwarding to forward port 5000 of A to The local host, for example, the forwarded port is 5000, and then start a vscode, use remote-ssh, connect to the local port 5000, and then you can access server B for development. The ssh config settings are as follows:

Host serverB

    HostName localhost

    User root (serverB的用户,如果是docker用的基本上是root,不是就换成serverB的用户名)

    Port 5000

issue:

Connecting to the remote server keeps getting stuck

 Got request to download on client for {"platform":"linux","arch":"x64","destFolder":"/root/.vscode-server/bin/xxxxxxxxxxxxxxx"}

My solution is to directly change the name of the xxxx file under this bin

Then reconnect, so that vscode will re-download vscode-server, and you can connect after the download is complete

Guess you like

Origin blog.csdn.net/qq_31638535/article/details/131717403