squid服务以及bond网卡阵列

来源:互联网 发布:linux查看jvm版本 编辑:程序博客网 时间:2024/06/18 13:33

##########squid正向代理###

拥有网络的主机:
[root@foundation6 network-scripts]# yum install squid -y                   ##安装squid服务
[root@foundation6 network-scripts]# systemctl start squid
[root@foundation6 network-scripts]# netstat -antlpe |grep squid     ##查看网络接口
tcp6       0      0 :::3128                 :::*                    LISTEN      0          148895     15807/(squid-1)     
[root@foundation6 network-scripts]# vim /etc/squid/squid.conf        ##编辑配置文件
58 http_access allow all

64 cache_dir ufs /var/spool/squid 100 16 256


[root@foundation6 network-scripts]# systemctl restart squid

测试结果:




#########squid反向代理###

#加速:

[root@test html]# yum install squid -y
[root@test html]# vim /etc/squid/squid.conf          ##编辑配置文件
http_port 80 vhost vport

cache_peer 172.25.254.106 parent 80 0 no-query originserver



[root@test html]# systemctl restart squid

轮叫机制:


[root@test html]# vim /etc/squid/squid.conf        ##编辑配置文件
http_port 80 vhost vport
cache_peer 172.25.254.124 parent 80 0 no-query originserver name=web1 round-robin weight=1   ##出现1次
cache_peer 172.25.254.133 parent 80 0 no-query originserver name=web2 round-robin weight=3  ##出现3次
cache_peer_domain www.westos.com web1 web2

[root@test html]# systemctl restart squid

测试结果:



######网卡阵列bond#####

[root@test Desktop]# nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup  ip4 172.25.254.106/24                       ##创建网卡阵列active-backup模式的bond0
Connection 'bond0' (1d1f7a40-9311-428e-988c-b71e8e4206e9) successfully added    .
[root@test Desktop]# nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0           ##将eth0网卡添加进入该阵列中
Connection 'eth0' (05a9733b-1af7-43fd-8571-4fec796c97bb) successfully added.
[root@test Desktop]# nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0           ##将eth1网卡添加进入该阵列中
 Connection 'eth1' (f4f5b1ec-1fa8-4227-92ae-93d84c7b4ec2) successfully added.
[root@test Desktop]# ifconfig eth0 down           ##模拟网卡损坏,进行测试
[root@test Desktop]# ifconfig eth0 up

[root@test Desktop]# ifconfig eth1 down