Using SSH to achieve access to the machine within the LAN

Source: Internet
Author: User

"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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.