Browser uses socks5 proxy

As shown in the figure below, in LAN 1, the PC and the web server belong to the same LAN, and the PC can directly access the web server page through the intranet IP (192.168.1.5). However, if you want to access the web server (192.168.15.31) of LAN 2 through the intranet ip, it is more difficult. So how can the PC in LAN 1 access the web server page of LAN 2 through a browser?

From the web server, if you want external users to be able to access, you can map the server port to a server with a public IP (or domain name), such as mapping port 80 of 192.168.15.31 to port 8000 of 114.117.2.32, so that users can He can be reached by visiting 114.117.2.32:8000.

But if the web server of LAN 2 does not map the port to the external network ip, how can I access it through the browser on LAN 1? At this time, you can access the web server of LAN 2 through the proxy of socks5 of the local browser.

network diagram

Specific operations:
1) Create a connection with the public network server of LAN 2 through ssh on the local terminal:

ssh -qTfnN -D 0.0.0.0:17070 user@114.117.2.32 -p 22
password:

#  -q 静默模式
#  -T 禁用伪终端分配
#  -f  后台运行
#  -n  阻止从标准输入读取。后台运行的话,必须使用。
#  -N 不执行远程命令
#  -D [bind_address : port] 本地动态应用级端口转发。没有指定address将监听在127.0.0.1上。

2) Set the browser socks5 proxy
Set preferences

The connection is just made on the local machine, so the IP can be written as 172.0.0.1 or the local ip192.168.1.20. If you choose to execute the ssh command on another server or PC, you need to enter the IP of the server or PC that executes the command. In addition, the port setting also needs to be consistent with the command.

After saving and restarting the browser, you can enter the intranet IP (192.168.15.31) of the web server in LAN 2 in the PC browser in LAN 1 to access the web server page.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325810841&siteId=291194637