HAProxy / Keepalived not forwarding traffic

Hi All,

I am really new to HAProxy and Keepalived its been a steep learning curve this week, but I think I am almost at my end goal and my suspicion is that I am missing a really simple step to achieve what I need to. I would really appreciate any help someone could give me.

THe issue I am having is that the load balancer does not appear to be forwarding traffic to the backends when using the VIP. I can ping the VIP so I know its up.

I was able to perform a curl http://192.168.5.42 command and get the desired response, from the MASTER node itself. However I then in my attempt to resolve the issue added an HAProxy.xml file to the /etc/firewalld/services folder with the below settings and now I cannot perform that command:

<?xml version="1.0" encoding="utf-8"?> HAProxy HAProxy load-balancer

In my lab I have the following setup

2 x RHEL 7.6 servers with HAProxy and Keepalived installed

2 x Windows 2016 IIS servers with default IIS page with bindings on 80

RHEL-A Keepalived setup:

! Configuration File for keepalived

global_defs {
notification_email {
acassen@firewall.loc
failover@firewall.loc
sysadmin@firewall.loc
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id LVS_DEVEL
vrrp_skip_check_adv_addr
vrrp_strict
vrrp_garp_interval 0
vrrp_gna_interval 0
}

vrrp_instance VI_1 {
state MASTER
interface ens33
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.5.42 dev ens33 label ens33:100
}
}
virtual_server 192.168.5.42 80 {
delay_loop 10
protocol TCP
lb_algo rr

Use direct routing

lb_kind DR
persistence_timeout 7200

real_server 192.168.5.50 80 {
    weight 1
    TCP_CHECK {
      connect_timeout 5
      connect_port 80
    }
}

real_server 192.168.5.51 80 {
    weight 1
    TCP_CHECK {
      connect_timeout 5
      connect_port 80
    }
}

}

RHEL-A HAProxy Setup

#---------------------------------------------------------------------

Example configuration for a possible web application. See the

full configuration options online.

http://haproxy.1wt.eu/download/1.4/doc/configuration.txt

#---------------------------------------------------------------------

#---------------------------------------------------------------------

Global settings

#---------------------------------------------------------------------
global
# to have these messages end up in /var/log/haproxy.log you will
# need to:
#
# 1) configure syslog to accept network log events. This is done
# by adding the ‘-r’ option to the SYSLOGD_OPTIONS in
# /etc/sysconfig/syslog
#
# 2) configure local2 events to go to the /var/log/haproxy.log
# file. A line like the following can be added to
# /etc/sysconfig/syslog
#
# local2.* /var/log/haproxy.log
#
log 127.0.0.1 local2

chroot      /var/lib/haproxy
pidfile     /var/run/haproxy.pid
maxconn     4000
user        haproxy
group       haproxy
daemon

# turn on stats unix socket
stats socket /var/lib/haproxy/stats

#---------------------------------------------------------------------

common defaults that all the ‘listen’ and ‘backend’ sections will

use if not designated in their block

#---------------------------------------------------------------------
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000

#---------------------------------------------------------------------

main frontend which proxys to the backends

#---------------------------------------------------------------------
frontend main
bind 192.168.5.42:80
default_backend app

#---------------------------------------------------------------------

static backend for serving up images, stylesheets and such

#---------------------------------------------------------------------
backend static
balance roundrobin
server static 127.0.0.1:4331 check

#---------------------------------------------------------------------

round robin balancing between the various backends

#---------------------------------------------------------------------
backend app
balance roundrobin
server app1 192.168.5.50
server app2 192.168.5.51

RHEL-B Keepalived setup

! Configuration File for keepalived

global_defs {
notification_email {
acassen@firewall.loc
failover@firewall.loc
sysadmin@firewall.loc
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id LVS_DEVEL
vrrp_skip_check_adv_addr
vrrp_strict
vrrp_garp_interval 0
vrrp_gna_interval 0
}

vrrp_instance VI_1 {
state BACKUP
interface ens33
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.5.42 dev ens33 label ens33:100
}
}
virtual_server 192.168.5.42 80 {
delay_loop 10
protocol TCP
lb_algo rr

Use direct routing

lb_kind DR
persistence_timeout 7200

real_server 192.168.5.50 80 {
    weight 1
    TCP_CHECK {
      connect_timeout 5
      connect_port 80
    }
}

real_server 192.168.5.51 80 {
    weight 1
    TCP_CHECK {
      connect_timeout 5
      connect_port 80
    }
}

}

RHEL-B HAProxy Setup

#---------------------------------------------------------------------

Example configuration for a possible web application. See the

full configuration options online.

http://haproxy.1wt.eu/download/1.4/doc/configuration.txt

#---------------------------------------------------------------------

#---------------------------------------------------------------------

Global settings

#---------------------------------------------------------------------
global
# to have these messages end up in /var/log/haproxy.log you will
# need to:
#
# 1) configure syslog to accept network log events. This is done
# by adding the ‘-r’ option to the SYSLOGD_OPTIONS in
# /etc/sysconfig/syslog
#
# 2) configure local2 events to go to the /var/log/haproxy.log
# file. A line like the following can be added to
# /etc/sysconfig/syslog
#
# local2.* /var/log/haproxy.log
#
log 127.0.0.1 local2

chroot      /var/lib/haproxy
pidfile     /var/run/haproxy.pid
maxconn     4000
user        haproxy
group       haproxy
daemon

# turn on stats unix socket
stats socket /var/lib/haproxy/stats

#---------------------------------------------------------------------

common defaults that all the ‘listen’ and ‘backend’ sections will

use if not designated in their block

#---------------------------------------------------------------------
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000

#---------------------------------------------------------------------

main frontend which proxys to the backends

#---------------------------------------------------------------------
frontend main
bind 192.168.5.42:80
default_backend app

#---------------------------------------------------------------------

static backend for serving up images, stylesheets and such

#---------------------------------------------------------------------
backend static
balance roundrobin
server static 127.0.0.1:4331 check

#---------------------------------------------------------------------

round robin balancing between the various backends

#---------------------------------------------------------------------
backend app
balance roundrobin
server app1 192.168.5.50
server app2 192.168.5.51