SSH remote forwarding enables remote hosts to listen on all IPs

Source: Internet
Author: User
Tags svn client

Cause: Suddenly overnight telecommunications disturbance Dial IP Full change intranet address, so that even with the dynamic domain name, the binding is not a native IP, external inaccessible. Although the telephone to find the telecommunications reflect that can be changed back, but must first solve the immediate problem, access to the SVN repository on the intranet server.

Method: Because there is a cloud host on the public network, think can pass through it, as long as the intranet host first establish a connection with the cloud host, this can be used SSH remote forwarding function, the command is as follows:

Ssh-gn-r 3690:0.0.0.0:3690-o serveraliveinterval=60 [email protected]

As a result, the connection is established, but at this point the access to the cloud host port 3690 is not connected, go up to check the port status:

[[Email Protected]:~]netstat-ln-a inet

The output is as follows:

Active Internet connections (only servers)

Proto recv-q send-q Local address Foreign address state

TCP 0 0 127.0.0.1:3690 0.0.0.0:* LISTEN

TCP 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN

......

Display 3690 while listening, but only valid on 127.0.0.1, cannot accept external connections.

But I've already added the-G parameter to the SSH manual saying this option will bind the port to the external IP so that the other machines can connect, but why is this invalid?

Google learns the Answer (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=228064):

Original-G is only valid for local forwarding, to make remote forwarding also use external IP, you must modify the Sshd_config on the remote host, increase

Gatewayports Yes

Then restart the SSH service.

Re-establish the forwarding and check the connection, found that the 0.0.0.0:3690 is listening, open SVN client update smooth Execution!

SSH remote forwarding enables remote hosts to listen on all IPs

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.