Step 1) install squid on 132.1.16.100 box
dev@kvm2:~$ sudo apt-get install squid3
dev@kvm2:~$ ps ax|grep squid
11700 ? Ss 0:00 /usr/sbin/squid3 -N -YC -f /etc/squid3/squid.conf
11704 ? Ss 0:00 (logfile-daemon) /var/log/squid3/access.log
11783 pts/3 S+ 0:00 grep --color=auto squid
dev@kvm2:~$ telnet localhost 3128
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
^]
dev@kvm2:~$ export HTTP_PROXY="localhost:3128"
dev@kvm2:~$ wget --proxy=on google.com
[ <=> ] 14,396 --.-K/s in 0.01s
2018-10-19 11:32:09 (1.21 MB/s) - ‘index.html’ saved [14426]
dev@kvm2:~$ export HTTPS_PROXY="localhost:3128"
dev@kvm2:~$ wget --proxy=on google.com
[ <=> ] 14,396 --.-K/s in 0.01s
2018-10-19 11:32:26 (1.19 MB/s) - ‘index.html.1’ saved [14396]
root@kvm2:~# grep "http_access allow all" /etc/squid3/squid.conf
http_access allow all
root@kvm2:~#
restart the squid service
root@kvm2:~# ps -ef | grep squid
root 13143 1 0 11:38 ? 00:00:00 sudo /usr/sbin/squid3 -N -YC -f /etc/squid3/squid.conf
proxy 13144 13143 0 11:38 ? 00:00:07 /usr/sbin/squid3 -N -YC -f /etc/squid3/squid.conf
proxy 13145 13144 0 11:38 ? 00:00:00 (logfile-daemon) /var/log/squid3/access.log
root 37164 37034 0 16:44 pts/6 00:00:00 grep --color=auto squid
root@kvm2:~#
step 2) ssh port forward on 172.16.30153
C:\Users\opsadmin>ssh -R 9002:132.1.16.100:3128 ansible@172.16.30.153
Last login: Fri Oct 19 11:45:22 2018 from 10.212.134.202
ansible@ubuntuTest:~$ telnet localhost 9002
Trying ::1...
Connected to localhost.
Escape character is '^]'.
^]
ansible@ubuntuTest:~$ export http_proxy="localhost:9002"
ansible@ubuntuTest:~$ export https_proxy="localhost:9002"
ansible@ubuntuTest:~$ wget --proxy=on google.com
--2018-10-19 11:49:20-- http://google.com/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:9002... connected.
Proxy request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/ [following]
--2018-10-19 11:49:21-- http://www.google.com/
Reusing existing connection to [localhost]:9002.
Proxy request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’
[ <=> ] 14,393 --.-K/s in 0.03s
2018-10-19 11:49:21 (550 KB/s) - ‘index.html’ saved [14393]
root@ubuntuTest:/var/www/html/zabbix# cat /etc/apt/apt.conf
Acquire::http::Proxy "http://localhost:9002";
Acquire::https::Proxy "https://localhost:9002";
Acquire::ftp::Proxy "ftp://localhost:9002";
root@ubuntuTest:/var/www/html/zabbix#
No comments:
Post a Comment