F
F
fralik2012-05-16 10:45:42
Computer networks
fralik, 2012-05-16 10:45:42

How to get information from a machine behind a gray ip address?

There is a machine, let's call it the target computer (CC or target.host), on which Apache is running. The target has a gray dynamic IP address, i.e. from outside to it not to be connected. There is another machine with a static IP and an attached example.com domain. Let's call it a server. There is a user who wants to access the site on the target computer.
Question: are there ready-made solutions for creating a tunnel that can forward requests addressed to the server to the target computer, and give the CC responses to the user? At the same time, I would like the user to be able to go to test.example.com in the browser and the contents of test.target.host would be shown to him.
Or can it be done only by writing your own program? And in this case, the user will already access the site through additional software installed on his computer (in the form of a separate program or plug-in in the browser).

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
Alukardd, 2012-05-16
@fralik

ssh -CND [email protected] -R 80:127.0.0.1:apache_port
I'm not sure at all that this will work, because. you will try to occupy port 80, on which, as I understand from the explanation, apache hangs anyway. So it's better to replace 80 with something left (for example, 8791), and on the "server" describe the TC virtualhost (test.example.com) as you wanted and point it to ProxyPass at 127.0.0.1 : 8791/.
In addition, the example with port 80 and the user "user" is inoperative, because the port is privileged and the user will not be able to listen on it.
> The -CND options are needed so that ssh compresses traffic and does not start a shell.
The -D option is needed for dynamic port forwarding in the other direction (read creating local socks through a remote server). And all the keys, including the -R we need, should be written before the name of the host to which we are connecting, although ssh will probably “eat” this option as well.

@
@sledopit, 2012-05-16
_

You don't need to write anything.
With target.host set up passwordless ssh authorization and run the command

ssh -CND [email protected] -R 80:127.0.0.1:apache_port

and actually after that you can access remote.host on port 80 as if you had Apache running on it, and not on target.host. You can use the autossh
utility to make sure that ssh reconnects on its own in the event of disconnections . The -CND options are needed in order for ssh to compress traffic and not start a shell.

S
smartlight, 2012-05-16
@smartlight

you can make everything easier using dns
1. on a host with a gray ip, you raise the dyndns service
2. in the example.com domain zone, make a record test.example.com CNAME my.dyndns.host

A
Andrey Burov, 2012-05-16
@BuriK666

Put nginx on a server with a static IP and redirect the necessary requests to target.host.
Well, or DNAT

E
eaa, 2012-05-16
@eaa

Well, for example, port mapping. I did this on a home router, behind which there was a computer, with standard tools that were in the firmware of the device.

V
Vlad Zhivotnev, 2012-05-16
@inkvizitor68sl

Yes, ssh is called.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question