对于LVS的持久连接来说常见的分为三种PCC,PPC和基于防火墙标记的持久连接
1.PCC用来实现把某个用户的所有访问在超时时间内定向到同一台REALSERVER
2.PPC用来把某个用户对同一服务的访问在超时时间内定向到同一台sREALSERVER
3.基于防火墙标记的持久连接
拓扑图如下:
一.PCC用来实现把某个用户的所有访问在超时时间内定向到同一台REALSERVER
步骤如下:
1.对real server1和real server2 ip正确配置并
安装httpd服务,测试网页分别为test1 和 test2
2.使用命令sysctl -a |grep arp 查看arp_announce和arp_ignore的值
[root@localhost ~]# sysctl -a |grep arp
net.ipv4.conf.eth0.arp_ignore = 0
net.ipv4.conf.eth0.arp_announce = 0
将arp_announce的值改为2,将arp_ignore的值改为为1,/etc/sysctl.conf
[root@localhost ~]# echo "net.ipv4.conf.eth0.arp_announce = 2" >> /etc/sysctl.conf
[root@localhost ~]# echo "net.ipv4.conf.all.arp_announce = 2" >> /etc/sysctl.conf
[root@localhost ~]# echo "net.ipv4.conf.eth0.arp_ignore = 1" >> /etc/sysctl.conf
[root@localhost ~]# echo "net.ipv4.conf.all.arp_ignore = 1" >> /etc/sysctl.conf
[root@localhost ~]# sysctl -p #使服务生效
5.net.ipv4.conf.eth0.arp_announce = 2
6.net.ipv4.conf.all.arp_announce = 2
7.net.ipv4.conf.eth0.arp_ignore = 1
8.net.ipv4.conf.all.arp_ignore = 1
3.配置realserver1的loopback0:0的ip地址,子网掩码为4个 255
设置lo的ip