proxy 服务器配置

代理服务器,可以通过其来实现防火墙功能与网络浏览数据分析等功能。与iptables不同,防火墙功能也是作用在应用层。Proxy在局域网,对内网和外网均有作用。
proxy 服务器配置_第1张图片

[root@paly ~]#yum install squid
Loaded plugins: fastestmirror
Setting up Install Process
Repository base is listed more than once in the configuration
Loading mirror speeds from cached hostfile
base                                                                              | 3.7 kB     00:00     
epel                                                                              | 4.7 kB     00:00     
extras                                                                            | 3.3 kB     00:00     
updates                                                                           | 3.4 kB     00:00     
Package 7:squid-3.1.23-24.el6.i686 already installed and latest version
Nothing to do

这里写一条将baidu.com ban了的规则。
proxy 服务器配置_第2张图片

[root@paly ~]#vim /etc/squid/mime.conf
[root@paly ~]#id squid
uid=23(squid) gid=23(squid) groups=23(squid),88(wbpriv)
[root@paly ~]#vim /etc/squid/squid.conf
[root@paly ~]#/etc/init.d/squid start
Starting squid: ..                                         [  OK  ]
[root@paly ~]#/etc/init.d/squid restart
Stopping squid: 2022/04/06 01:23:17| WARNING: Could not determine this machines public hostname. Please configure one or set 'visible_hostname'.
2022/04/06 01:23:17| WARNING: Could not determine this machines public hostname. Please configure one or set 'visible_hostname'.
................                                           [  OK  ]
Starting squid: ...                                        [  OK  ]
[root@paly ~]#hostname
paly 
[root@paly ~]#vim /etc/hosts
[root@paly named]#cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.31.224 paly
192.168.1.254 paly
[root@paly named]#
[root@paly ~]#/etc/init.d/squid restart					#重启服务
[root@paly ~]#service iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@paly ~]#vim /etc/squid/squid.conf  
[root@paly ~]#/etc/init.d/squid restart
Stopping squid: ................                           [  OK  ]
Starting squid: .                                          [  OK  ]
[root@paly ~]#vim /etc/squid/squid.conf
[root@paly ~]#/etc/init.d/squid restart
Stopping squid: ................                           [  OK  ]
Starting squid: .                                          [  OK  ]
[root@paly ~]#
[root@paly ~]#netstat -tulnp | grep squid
tcp        0      0 :::3128                     :::*                        LISTEN      21879/(squid)       
udp        0      0 0.0.0.0:46476               0.0.0.0:*                               21879/(squid)       
udp        0      0 :::54449                    :::*                                    21879/(squid)       
[root@paly ~]#

作用于xp

效果
proxy 服务器配置_第3张图片

配置
proxy 服务器配置_第4张图片

作用于win10

配置

proxy 服务器配置_第5张图片
效果
proxy 服务器配置_第6张图片

你可能感兴趣的:(#,服务器,proxy)