The objective of this post is explain how to set up a tunnel from M1 to M2, in order to M2 could access to services published in M1.
In this case, M1 has an Apache server published in port 80, and I want M2 could be able to call it.
The simplest way is by using PuTTY (https://es.wikipedia.org/wiki/PuTTY)
In M1, you have to open PuTTY and go to Connection > SSH > Tunnels. In this page you have to configure:
- Source port: This is the port we use to trick M2. When M2 call sfor localhost and this port, it will be being calling another direction instead.
- Destination: This is the URL M2 will be being calling when it called localhost and source port.
In this example, source port is 8088 (it could be any free port in M2) and it will point to localhost:80 (localhost is M1).
Once the tunnel is configured, go to Session and set the Host Name (or IP) of M2 to open a connection.
With this configuration, anytime someone (say a user, a web app, a portlet, etc.) in M2 call for http://localhost:8088/xxxx it will be redirected to http;//M1:80/xxxx.
For example, you can type the following command in order to verify the tunnel:
[root@M2 ~]# curl localhost:8088 <<html><body><h1>It works!</h1></body></html> [root@M2 ~]#
Note that the "it works" is the default page of Apache httpd in M1, called from M2!
No hay comentarios:
Publicar un comentario