HAProxy community

Issue with HaProxy - trying to use it for TCP failover?

Hello! First time user. Decided to make an account here since I’ve been struggling for a week with a problem

I have 2 QNAP NAS which are being used on Windows machines for mapped drives. I thought it would be cool to have a failover for them. The data across the 2 NAS systems is replicated in real-time over my network and is identical.


I have a linux machine (Ubuntu) running in VMware workstation, hosted on Windows 2016 server. Right now, the Ubuntu machine has a a static IP of QNAP uses smb2 on port 445. The windows clients in my environment map network drives as an example to \\Files, \\Stuff, etc.

Below is the haproxy configuration

log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy

log global
mode tcp
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http

listen QNAP
mode tcp
option tcplog
default_backend QNAP_NAS

backend QNAP_NAS
mode tcp
option tcplog
log global
balance roundrobin
timeout connect 5s
timeout server 10s
server Asgard1 check inter 5s fall 1 rise 10
server Asgard3 check backup

So the above configuration works…technically. I can map drives on the windows clients like \\Stuff, etc. However, when I try to test the failover, by restarting the NAS the Windows client is currently connected to, everything is still unavailable and the file shares cannot connect. It seems that when I map the drive on the windows client, it connects to 1 of the NAS, say If I reboot that NAS @, all the network shares disconnect.

I can see in the haproxy logs that it registers the NAS as down, 0 live and 1 backupo, etc. but the failover just doesn’t work.

It is entirely possible I’m missing a piece, or not understanding something, so I’m hoping someone can help. Remapping the drives using “net use a: /delete” and then “net use a: \\Stuff /persistent:Yes” doesn’t seem to work either. The Windows client seems to want to still go to the NAS that is shutdown. Maybe because there are other drives mapped via the .200 address that are actually pointing to .35 in the load balancer?

Any help would be greatly appreciated! Kind of driving me nuts lol