Network topology
反向代理
Lan PC 可以ssh到Internet上的PC, 但是Internet上的PC不能ssh到Lan PC.
如果想internet上PC能夠ssh到lan PC, ssh 反向代理的解決辦法:
1. 在lan PC上執行如下命令:
$ ssh [email protected] -R 21436:127.0.0.1:22
2. 在Internet PC上執行
$ ssh -p 21436 [email protected]
3. 此時,在Internet PC即可ssh連接到Lan PC上。
說明:
1) wanuser: 登錄Internet PC的用戶名;
2) lanuser: 登錄Lan PC的用戶名;
3) 21436: lan PC ssh到Internet PC後在Internet PC上啓動的監聽端口;Internet上的用戶ssh到這個端口即可ssh連接到Lan PC.
4) man ssh