"1" target
Two machines, A, B, are in two different LANs, and there is no public IP. Now you want to be able to implement remote operations from host A to B
A transit machine with a public IP is required C CIP
Before the online view Raiders found that you can use SSH through a transit server with a public network IP to achieve this goal, the specific strategy see
Http://www.jb51.net/hack/58514.html
This method uses a monitoring script to implement the short-term reconnection function, which is to check if there is a process "ssh-n-r-f" at intervals on B, if not, then the connection is determined to be disconnected. If none, the connection command is executed.
In practice, however, it is found that the "ssh-f-n-r" process in B still exists, but in fact the C machine has closed the corresponding port, so there will be a case where the connection from a is less than B. To solve this problem, I came up with the following scenario:
"1" on machine C every once in a while to monitor the target port is open, if it is open, do nothing, if not open, write a file
"2" on machine B every once in a while to download files from machine C, if present, do nothing, otherwise, the connection is performed.
Using SSH to achieve access to the machine within the LAN