A maneira mais fácil é executar um proxy (fe squid) em seu servidor remoto e fazê-lo ouvir apenas na interface local 127.0.0.1
(porque você não quer abrir um proxy para a internet).
Em seguida, você ssh no servidor remoto e criar um encaminhamento tcp para a interface de proxy local no servidor remoto.
Por exemplo, digamos que seu proxy no servidor remoto 162.xx.xx.xx
esteja escutando em tcp 127.0.0.1:3128
. Agora você pode se conectar a ele com ssh com este comando:
ssh -p 25512 -L 3128:127.0.0.1:3128 -C 162.xx.xx.xx
Isso abre um túnel do 127.0.0.1:3128
do seu cliente para os hosts remotos 127.0.0.1:3128
. Então você pode simplesmente configurar seu navegador no cliente para usar o proxy 127.0.0.1:3128
, que é então encapsulado via ssh para o host remoto e passado para o proxy lá.
O parâmetro -C
ativa a compactação e deve facilitar sua navegação um pouco mais rápido, porque menos dados precisam ser transmitidos.
Estas são as partes relevantes de man 1 ssh
:
-L [bind_address:]port:host:hostport
Specifies that the given port on the local (client) host is to be forwarded to
the given host and port on the remote side. This works by allocating a socket
to listen to port on the local side, optionally bound to the specified
bind_address. Whenever a connection is made to this port, the connection is
forwarded over the secure channel, and a connection is made to host port
hostport from the remote machine. Port forwardings can also be specified in
the configuration file. IPv6 addresses can be specified by enclosing the
address in square brackets. Only the superuser can forward privileged ports.
By default, the local port is bound in accordance with the GatewayPorts
setting. However, an explicit bind_address may be used to bind the connection
to a specific address. The bind_address of “localhost” indicates that the
listening port be bound for local use only, while an empty address or ‘*’
indicates that the port should be available from all interfaces.
-C Requests compression of all data (including stdin, stdout, stderr, and data for
forwarded X11 and TCP connections). The compression algorithm is the same used
by gzip(1), and the “level” can be controlled by the CompressionLevel option
for protocol version 1. Compression is desirable on modem lines and other slow
connections, but will only slow down things on fast networks. The default
value can be set on a host-by-host basis in the configuration files; see the
Compression option.
-p port
Port to connect to on the remote host. This can be specified on a per-host
basis in the configuration file.