I have a local machine with no access to internet and one that does. In my local network, I'm only able to connect to that machine after connecting via ssh to two other machines.
Local (123.123.123.0) ---> Host1 (123.123.123.1) ---> Host2 (123.123.123.2) ---> Host3 (123.123.123.3)
The way I'm accessing internet is only using lynx on Host 3 (the one that has access to the internet) after hopping between the other two hosts.
The process is as follows:
local$ ssh [email protected]
host1$ ssh [email protected]
host2$ ssh [email protected]
host3$ lynx google.com
I wanted to connect to host3 via dynamic port forwarding so I could access it using firefox through SOCKS, however I don't really know how to do it with two machines as proxies (Host1 and Host2).
I've tried ssh -D 8081 [email protected] ssh -D 8082 [email protected] ssh -D 8083 [email protected] and configuring firefox to use 123.123.123.1:8080 SOCKS proxy, but it didn't work.
Assuming ssh keys¹ are setup for each host, you can run below to jump to the final host
¹ ssh keys from local host to each of the hosts. No need to have keys from host1 to host2 (but not sure if they will be used if present)