In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what are the ways of ssh port forwarding". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
How does SSH port forwarding work
These days, teamviewer was affected by the hack, so he thought of intranet penetration by remote control, and naturally thought of SSH port forwarding to achieve intranet penetration. Think about it again, and find that SSH tunnel, or port forwarding, actually realizes three common network functions: forward proxy, reverse proxy and intranet penetration, and admires its powerful functions and convenience in use.
SSH has three port forwarding modes
local forwarding
Local Port Forwarding is the forwarding of traffic from a port of a local host to a specified port of a remote host. The command line syntax is: -L[bind_address]:localport:[remote_host]:remote_port. "-L" is the initial letter of "local," similar remote forwarding "-R" is the initial letter of "remote," dynamic forwarding "-D" is the initial letter of "dynamic," easy to remember.
In this command, the local port 5901 is forwarded to the remote host port 5901 through the ssh tunnel. When connecting remotely, enter localhost or ports 127.0.0.1 and 5901 to connect to the remote host port 5901. Through local forwarding of iptables and ssh, the purpose that others cannot connect and only they can access is realized.
remote forwarding
Remote Port Forwarding is the forwarding of a port on a remote host to a specified port on the remote host. The command line syntax is: -R[bind_address]:port:[local_host]:local_port.
The most common feature of remote forwarding is intranet penetration. If there is a host with a public IP, it can use the remote forwarding of the SSH tunnel to achieve the purpose of accessing the intranet resources from the external network. It should be noted that ssh remote forwarding can only bind to the local address of the remote host by default, that is, 127.0.0.1. If you want to listen for connections from other hosts, you need to modify the configuration of ssh on the remote host, change "GatewayPorts" to "yes", and restart ssh to take effect.
dynamic forwarding
Whether forwarding locally or remotely, you need to specify ports for both local and remote hosts. Dynamic Port Forwarding gets rid of this limitation and binds only local ports, with remote hosts and ports determined by the originating request. The syntax for dynamic forwarding is: "-Dbind_address:port", an example of forwarding:
Dynamic forwarding actually realizes the function of forward proxy, so it can be used to access the Internet scientifically. Local forwarding can also be used as a forward proxy, but it is cumbersome to forward each request host and port, which is not used in practice.
"What are the ways of ssh port forwarding?" The content is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.