1) IP配置(配置回环接口添加虚拟ip,让他代为转发)
/sbin/ifconfig lo:0 192.168.1.96 broadcast 192.168.1.96 netmask 255.255.255.255 up
/sbin/ifconfig lo:1 192.168.1.97 broadcast 192.168.1.97 netmask 255.255.255.255 up
/sbin/route add -host 192.168.1.96 dev lo:0
/sbin/route add -host 192.168.1.97 dev lo:1
写入配置文件,开机自动执行 /etc/rc.local
1) ARP(arp)抑制配置,让当客户端发送广播的时候,realserver闭嘴
/etc/sysctl.conf
net.ipv4.conf.lo.arp_ignore=1
net.ipv4.conf.lo.arp_announce=2
net.ipv4.conf.all.arp_ignore=1
net.ipv4.conf.all.arp_announce=2
Director配置1.10和1.98:
1) keepalived配置
#给出部分参考配置
1.10
! Configuration File for keepalived
global_defs {
lvs_id BACKUP
}
vrrp_sync_group MAIL {
group {
VI_1_500
}
}
vrrp_instance VI_1_500 {
state BACKUP
interface eth0
virtual_router_id 95
#1.98的优先级设置为100
priority 150
advert_int 5
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.1.96/24
192.168.1.97/24
}
}
###############################################################
#this virtual server is the setting of Email Server SMTP port
###############################################################
virtual_server 192.168.1.97 25 {
delay_loop 6
lb_algo rr
lb_kind DR
persistence_timeout 50
protocol TCP
real_server 192.168.1.99 25 {
weight 1
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
connect_port 25
}
}
}