Keepalived LoadBalacing
LVS Config
## Pool ID
virtual_server <WAN "frontend" IP> 80 {
delay_loop 6
lb_algo sh # source hash
lb_kind NAT
protocol TCP
real_server <LAN "backend" IP Server 1> 80 {
weight 1
TCP_CHECK {
connect_timeout 3
}
}
real_server <LAN "backend" IP Server 2> 80 {
weight 1
TCP_CHECK {
connect_timeout 3
}
}
}
virtual_server <WAN "frontend" IP> 443 {
delay_loop 6
lb_algo sh # source hash
lb_kind NAT
protocol TCP
real_server <LAN "backend" IP Server 1> 443 {
weight 1
TCP_CHECK {
connect_timeout 3
}
}
real_server <LAN "backend" IP Server 2> 443 {
weight 1
TCP_CHECK {
connect_timeout 3
}
}
}
VRRP
vrrp_instance VI_LOCAL {
state MASTER
interface eth1
virtual_router_id 51
priority 101
virtual_ipaddress {
10.X.X.X
}
track_interface {
eth0
eth1
}
}
vrrp_instance VI_PUB {
state MASTER
interface eth0
virtual_router_id 52
priority 101
virtual_ipaddress {
X.X.X.X
}
track_interface {
eth0
eth1
}
}
vrrp_instance VI_PUB2 {
state MASTER
interface eth0
virtual_router_id 53
priority 101
virtual_ipaddress {
X.X.X.X
}
track_interface {
eth0
eth1
}
}