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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
It seems I'm a little over my head here so I'm hoping to get some help with setting up a way to forward all http and https requests for a particular server.
Here's the low down:
I have a server (Fedora 12) setup at a client's datacenter and the network is setup to allow me ssh access into the server, but prevents me from opening any connections from the server. However, I need to make http and https request from the server. What I'd like to do is forward all http/https traffic through another machine outside the network.
I've been looking at the documentation for ssh and the various options there and have gotten so far as to enable initiating an ssh connection from the client network back to my machine, but am not sure where to take it from there.
Here are some of the commands I've used so far:
Code:
# from my local machine
ssh -R 9022:localhost:22 remoteuser@clientserver
# from the remote machine, open normal ssh connection, works ok
ssh -p 9022 user@localhost
# from remote machine, no error, but http requests still fail
sudo ssh -p 9022 -R 80 user@localhost
I'm attempting to bind port 80 to be forwarded through the local machine. I assume I use "ssh -R" to create a dynamic tunnel to forward requests but I must be missing something.
By the way, root login via ssh is disabled.
I'd appreciate any input anyone might have. Thanks
Your solution seems to only forward requests for a specific IP. I don't know ahead of time what the IP/url will be requested, so I need a dynamic solution where all port 80 and port 443 requests are sent through the tunnel.
Your solution seems to only forward requests for a specific IP. I don't know ahead of time what the IP/url will be requested, so I need a dynamic solution where all port 80 and port 443 requests are sent through the tunnel.
I think IPTABLES could help you out, but I am not proficient in that.
I may have found the solution, but will have to wait until tomorrow to test it.
The http traffic I need to send through the ssh tunnel is from a java tool were providing to a client. The tool needs to make http(s) requests to upload data to a website. The trouble I was having was that the java code wasn't using the socks proxy server I had in effect created using the ssh -D flag. I set the system properties with:
host is set to "localhost" and port is the port number set with the -D flag in the ssh command. The java code is now using the tunnel as desired. However this is all on my test server, so we'll see how it goes tomorrow.
The only drawback is that this sends all traffic through the proxy, so if there's a local address you want to connect to, you have to clear the system property and then restore it when you're done.
Yes, that solution worked. Here's the ssh commands I used:
Code:
# forward port on server to local machine
[vigilandy@home ~]$ ssh -R 9022:localhost:22 user@server
# create proxy on port 9999 back through forwarded port
[user@server]$ ssh -p 9022 -D 9999 vigilandy@localhost
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.