The network looks like this : Server X -- My machine -- Server Y
My machine has SSH access to both boxes. Server Y has internet but not server X. How can I make a tunnel so server X can acces the internet through Y?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
There are several ways of doing this but none of them are good solutions. The way I would probably do it if I had to is like this:
From your machine, tunnel port 222 from your machine to port 22 server Y
ssh -L222:localhost:22 servery
From server X, create a dynamic tunnel from server X to server Y using the previously constructed tunnel. Note: your destination on this command is
mymachine but the credentials you'll use are for server Y since it's what you're actually connecting to.
ssh -D8080 -p 222 mymachine