squid forward agent
Principle: a machine that can't access the Internet can access the website that can't be accessed through the agent
Here I use my real machine as an agent. The virtual machine accesses the website through the agent
Operating System: Red Hat Enterprise Linux Server 7.2 (Maipo)
squid installation and configuration changes
Real machine (Internet accessible) IP: 172.25.254.56
[root@dream software]# yum install -y squid ###Download squid
[root@dream software]# vim /etc/squid/squid.conf
55 # And finally deny all other access to this proxy
56 http_access allow all ###Allow everyone to connect
57
58 # Squid normally listens to port 3128
59 http_port 3128
60
61 # Uncomment and adjust the following to add a disk cache directory.
62 cache_dir ufs /var/spool/squid 100 16 256 ###100M, 16 first level directories and 256 second level directories in / var/spool/squid
[root@dream squid]# systemctl start squid
[root@dream 00]# systemctl stop firewalld
If the firewall is not off: open port 3128 access
Browser in virtual machine:
IP:172.25.254.156
test
The host of the browser ping www.baidu.com is not available, but the browser can access the Internet
squid reverse proxy
Here I use two virtual machines, one IP: 172.25.254.156 and one IP: 172.25.254.102
IP:172.25.254.102
Note: the httpd service of this virtual machine will be shut down
[root@server ~]# yum install -y squid
[root@server ~]# vim /etc/squid/squid.conf ###You can view help at / usr/share/doc/squid-3.3.8/squid.conf.documented
55 # And finally deny all other access to this proxy
56 http_access allow all
57
58 # Squid normally listens to port 3128
59 http_port 80 vhost vport ###Access through port 80, virtual user, virtual port
60 cache_peer 172.25.254.156 parent 80 0 no-query ###Visit 172.25.254.156 through 80, 0 has no backup, no query: tell the server there is no backup
61
62 # Uncomment and adjust the following to add a disk cache directory.
63 cache_dir ufs /var/spool/squid 100 16 256
[root@server ~]# systemctl start squid
[root@server ~]# systemctl stop firewalld.service
IP:172.25.254.156
[root@mysql ~]# vim /var/www/html/index.html
<h1>172.25.254.156</h1>
[root@mysql ~]# systemctl start httpd