How to get Internet on a server using Squid Proxy and SSH port forwarding
Dec 27, 2018 00:39 · 144 words · 1 minute read
Do the setup as follows:
Setup on Host A:
- Install proxy server Squid on Host A . By default Squid listens on port 3128.
yum install squid
- Comment the
http_access deny all
then addhttp_access allow all
in /etc/squid/squid.conf - If Host A itself uses some proxy say 10.140.78.130:8080 to connect to internet then also add that proxy to
/etc/squid/squid.conf
as follows:refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880 cache_peer 10.140.78.130 parent 8080 0 no-query default never_direct allow all
Setup on Host B:
- Add the following entries to /etc/environment
export http_proxy=http://127.0.0.1:3129 export https_proxy=http://127.0.0.1:3129
source /etc/environment
Now our setup is complete.
Creating SSH tunnel with Remote port forwarding
- Run the follwoing SSH command from Host A
ssh -R 3129:localhost:3128 user@HostB
- This will allow Host B to access the internet through Host A.
Checking the internet:
- Run the following command from Host B
wget https://google.com