Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I want to know if this is possible, and if so how to do it.
Say I have my machine, which wants to connect to a machine outside on the outside world. But it does not have sufficient permissions on the network. However, my machine can access a remote machine on the local intranet that can access the outside machine. How can I, in one command, ssh from my machine to the outside machine, such that I can do port forwarding on it as if I was connected directly.
Then just connect to localhost:<localport> and the connection will be forwarded via the SSH pipe, and the middle server will make the request on your behalf
I need the -L option to be open, so I can use a command like this (i could do this before I lost these permissions/some software was updated and ssh got blocked by accident)
Code:
ssh -L someport:127.0.0.1:20 username@remotehost
That was my original command; I need to run that command, but through the intranet machine, as though the intranet machine was not there.
I have a friend running a service on port 20. I want to forward it (using ssh) to port 4444 on my machine, so that I can point some programs at it to access the service. I cannot make the connection directly because of the firewall in our intranet. Before I lost access over port 22 from my computer to the outside world (reasons unknown; happens to anyone using openSSH for some reason) the command:
Code:
ssh -L 4444:localhost:20 username@remotehost
worked great.
However, now I am isolated. I can connect to an intermediate server which can connect me to the remote server, as you decsribed like this:
I see 3 options:
1) Open 2 port forwards - one on each host - and daisy chain them. Slow and nasty and not what you're really after.
2) Use a different port for SSH between the primary hosts and leave the intermediate out of it.
3) Open your friends port 20 to public access instead of just localhost, then use firewall to restrict the hosts that are allowed to connect.
That's all I can think of - someone else probably has another alternative.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.