Help with starting to use HAProxy - LB ip address is not delegated to virtual machines



  • Hi,
    I am total beginner for HAProxy so please any advice will be much useful.
    I have two virtual machines on Microsoft Azure.
    They are in virtual network, and they have private IP addresses 10.0.9.4 and 10.0.9.5
    I created new Network interface on Microsoft Azure in the same virtual network with IP address 10.0.9.7
    Of course this is not delegated to any virtual machines.

    Name of interface is : lb.oozie.local, private IP address 10.0.9.7

    I added in /etc/hosts on .4 and .5
    10.0.9.7 lb.oozie.local

    I installed haproxy on both machines 4 and 5.
    haconfig file is the following:

    global
    log /dev/log local0
    log /dev/log local1 notice
    chroot /var/lib/haproxy

        stats timeout 30s
        #user haproxy
        #group haproxy
        daemon
    
        # Default SSL material locations
        ca-base /etc/ssl/certs
        crt-base /etc/ssl/private
    
        # Default ciphers to use on SSL-enabled listening sockets.
        # For more information, see ciphers(1SSL).
        ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL
    

    defaults
    log global
    mode http
    option httplog
    option dontlognull
    timeout connect 5000
    timeout client 50000
    timeout server 50000

    frontend localnodes
    bind lb.oozie.local:80
    mode http
    default_backend nodes

    backend nodes
    mode http
    balance roundrobin
    option forwardfor
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }
    option httpchk HEAD / HTTP/1.1\r\nHost:localhost
    server oozie1 10.0.9.4:11000 check
    server oozie2 10.0.9.5:11000 check

    listen stats lb.oozie.local:1936
    stats enable
    stats uri /haproxy?stats

    I did also:
    sudo service haproxy restart

    Redirecting to /bin/systemctl restart haproxy.service

    Validation returns that haproxy is valid:
    haproxy -f /etc/haproxy/haproxy.cfg -c

    [WARNING] 284/112531 (110051) : config : frontend ‘GLOBAL’ has no ‘bind’ directive. Please declare it as a backend if this was intended.
    Configuration file is valid

    As I understood my servers should get the ip address (10.0.9.7).

    I try from 10.0.9.4 and 10.0.9.5 ping to 10.0.9.7

    but on both servers I am getting it is not recognized.
    ping 10.0.9.7

    PING 10.0.9.7 (10.0.9.7) 56(84) bytes of data.
    From 10.0.9.4 icmp_seq=1 Destination Host Unreachable
    From 10.0.9.4 icmp_seq=2 Destination Host Unreachable

    Also if it is relevant:

    i installed keepalived mechanism
    I did not set public IP address for Load Balancer address, it has only private IP 10.0.9.7, because service is invoked directly from servers 10.0.9.4 and 10.0.9.5
    

    please help.
    Thank you in advance,