Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    can you setup a fail over for say Homeassistant like 2 Ips 1 domain name?

    Scheduled Pinned Locked Moved General pfSense Questions
    33 Posts 3 Posters 2.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      viragomann @comet424
      last edited by

      @comet424 said in can you setup a fail over for say Homeassistant like 2 Ips 1 domain name?:

      first you said i just need backend then steph siad i need a front end..then you said i need a front end but you did it with just a backend

      @viragomann said in can you setup a fail over for say Homeassistant like 2 Ips 1 domain name?:

      Any connection through HAproxy needs a frontend and a backend. I just managed the backend, because this does the trick of failover.

      Again, the frontend listens on an interface an port for requests like any other server does. And it forward the request to a backend, basically this can be based on ACLs, but this is not needed for your purpose. You can state your backend as default backend.

      In the backend settings you state the backend servers with IP addresses and ports. Since you want to realize a failover, you need to add both home assistant server to a single backed, the main as active, the backup as backup.

      Is this really as complicated?

      C 1 Reply Last reply Reply Quote 0
      • C
        comet424 @viragomann
        last edited by comet424

        @viragomann i did have both Active and backup of the ip address in Backend and you said that was wrong so i deleted the active

        as you seen in the pic i had both and then you bolded that i needed a single backend so the way you sounded i had to erase the active one

        V 1 Reply Last reply Reply Quote 0
        • V
          viragomann @comet424
          last edited by

          @comet424
          Your very first screenshot above shows both server as active. So I advised you

          @viragomann said in can you setup a fail over for say Homeassistant like 2 Ips 1 domain name?:

          So you should set the backup server as backup type in the backend.

          C 1 Reply Last reply Reply Quote 0
          • C
            comet424 @viragomann
            last edited by comet424

            @viragomann
            dont remember i talking about the picture right above your reply thats where it says Active and backup and when i read your message i then deleted the active image

            viragomann
            33 minutes ago

            @viragomann
            Please slow down and follow the suggestions.
            I told you to simply edit the backup server in the backend and change the type to "backup". You need a single backend.

            but ok so i put it back in i set it the way its in the pic... im sure i not done what else do i need to edit?

            C 1 Reply Last reply Reply Quote 0
            • C
              comet424 @comet424
              last edited by comet424

              so i tried to see if it works

              by trying http://homeassistant:8123 that didnt work
              i tried the name home_assistant:8123

              i tried
              192.168.0.1:8123 that didnt work either

              i did try changing the Listening interface from Localhost to LAN
              so it set it to
              192.168.0.1:8123

              now when i accessed that i got a 503 server error... but still couldnt access http://homeassistant to access the backup server
              or by the 192.168.0.1 pfsense box

              as i turned off the main home assitant... but ill keep playing around too.. trial and error (:

              i also checked off the box use forwarder.. i not sure if you need that checked off or not

              V 1 Reply Last reply Reply Quote 0
              • V
                viragomann @comet424
                last edited by

                @comet424
                Seems you're going on doing try and fail.

                by trying http://homeassistant:8123 that didnt work
                i tried the name home_assistant:8123

                Is the client able to resolve these host names to pfSense? You've probably to update your DNS accordingly.

                i did try changing the Listening interface from Localhost to LAN
                so it set it to
                192.168.0.1:8123

                Localhost only makes sense if you forward the packets on the incoming interface port 8123 to it.
                Otherwise let HAproxy listen on the interface address.

                now when i accessed that i got a 503 server error... but still couldnt access http://homeassistant to access the backup server
                or by the 192.168.0.1 pfsense box

                If you look in the HAproxy stats, are the backends shown as online at all?

                Maybe we can get a step beyond, when you provide some more details about your network and the HAproxy settings.

                C 1 Reply Last reply Reply Quote 0
                • stephenw10S
                  stephenw10 Netgate Administrator
                  last edited by

                  We did a hangout covering HAProxy. It's old but the concepts are still valid: https://www.youtube.com/watch?v=FJSHMyrd29E

                  1 Reply Last reply Reply Quote 0
                  • C
                    comet424 @viragomann
                    last edited by comet424

                    ok ill check out that video now

                    @viragomann
                    ah i tried a bit and failed...

                    as for accessing

                    http://homeassistant:8123

                    ya all computers can access that and then i labled the 2nd home assistant homeassistant2:8123

                    the home_assistant:8123 that didnt work from using the name i was trying to understand it.. i was trying to find a video for dummies to explain it better what each one ment and explain it like those yellow dummies books

                    so in one of the videos i watched they set the forward listen to LAN not localhost.. but i can change it to local host

                    so my network is

                    Lan 192.168.0.0
                    Cameras 192.168.10.0
                    IoT 192.168.20.0
                    Dmz 192.168.40.0

                    home assistant has an ip for all the networks
                    192.168.0.12
                    192.168.10.12
                    192.168.20.12
                    192.168.40.12

                    all linked to the first one..

                    the backup home assistant is just on 192.168.0.10 i working on it later for bridging

                    the stats show red so i guessing it cant connect

                    so currently this is what i got.. so i wont change it so you know what i have at this moment

                    and i added a dns server to the settings page i do not know if i needed to or not

                    and it takes me time with my dislexia and learning disabilitty i need to read things sometimes 10 times to try to understand things.. sorry if i go to fast or too slow or miss stuff

                    haprox1.JPG haprox2.JPG haprox3.JPG haprox4.JPG

                    V 1 Reply Last reply Reply Quote 0
                    • V
                      viragomann @comet424
                      last edited by

                      @comet424 said in can you setup a fail over for say Homeassistant like 2 Ips 1 domain name?:

                      the stats show red so i guessing it cant connect

                      No, it just says that the health check failed.

                      HAproxy does health checking to determine if a backend server is alive. If the check is failing he sends no packets to it. Since both of yours are failing, it doesn't work.

                      There different methods of health checking you can set in the backend. At least "basic" should work. It only tries a TCP connection to the backend server. So try this.

                      and i added a dns server to the settings page i do not know if i needed to or not

                      I never set this. And for my understanding it is only useful if you state host names instead of IPs for the backend servers.

                      C 1 Reply Last reply Reply Quote 0
                      • C
                        comet424 @viragomann
                        last edited by

                        @viragomann
                        ah ok i set it to basic and did screen shot of stats

                        and ok i can delete the dns part...

                        haprox5.JPG

                        C V 2 Replies Last reply Reply Quote 0
                        • C
                          comet424 @comet424
                          last edited by

                          and here is my firewall rules id you need those too
                          firewall.JPG firewall2.JPG firewall3.JPG

                          1 Reply Last reply Reply Quote 0
                          • V
                            viragomann @comet424
                            last edited by

                            @comet424

                            i did try changing the Listening interface from Localhost to LAN
                            so it set it to
                            192.168.0.1:8123

                            now when i accessed that i got a 503 server error...

                            This error should be gone now, I think, if you set it up the same way again.

                            But maybe you have still an issue with the name resolution.
                            You mentioned different host names in the past. I'm not sure, which are you really need on the client to access the home assistant server. But you should point this to pfSense.

                            C 1 Reply Last reply Reply Quote 0
                            • C
                              comet424 @viragomann
                              last edited by

                              @viragomann

                              ya that error is gone.. and just the other error now

                              Hmmm… can't reach this page192.168.0.1 took too long to respond
                              Try:
                              
                              Search the web for 192 168 0 1
                              Checking the connection
                              Checking the proxy and the firewall
                              Running Windows Network Diagnostics
                              

                              thats trying to access home assistant now at 192.168.0.1:8123

                              well ya i did 2 different host names just to

                              and ya like
                              the actual host name for the main home assistant
                              is
                              homeassistant

                              the backup is just homeassistant2

                              but in the backend under name
                              i did homeassistant_main for homeassistant
                              and homeassistant_backup for homeassistant2

                              now if naming issues is a problem should the be both named homeassistant ?
                              or how you do it

                              or would it be better say

                              http://home.8123

                              and it points to
                              homeassistant:8123 (main)
                              homeassistant2:8123 (backup)

                              like i just learning i just trying i thought a dns resolver and u use domain name home and i pointed it to both servers like host overrides.. but that didnt seem to work right so i scrappped that..

                              sorry if my explaining sucks it seems ok in my head but when i explain it doesnt always sound right for others

                              C V 2 Replies Last reply Reply Quote 0
                              • C
                                comet424 @comet424
                                last edited by

                                if possible if you can make example screen shots i could enter in as ia visual learner that would help then id enter it the way it should be.. and then youd know exactly how it should look
                                if possible

                                1 Reply Last reply Reply Quote 0
                                • V
                                  viragomann @comet424
                                  last edited by

                                  @comet424 said in can you setup a fail over for say Homeassistant like 2 Ips 1 domain name?:

                                  thats trying to access home assistant now at 192.168.0.1:8123

                                  No way if the frontend is listening on localhost!
                                  We talked about this multiple times. You saw somewhere in a YT video that it was listening on localhost and fall back into this, despite I told you that this would require a forward to localhost.
                                  You can do this if you need to access the frontend from multiple network segments. But you would need to set the port forwardings, otherwise you won't succeed.
                                  However, I recommend to set the frontend to listen on the LAN address. This is also easier for the name resolution.

                                  the actual host name for the main home assistant is homeassistant
                                  the backup is just homeassistant2
                                  but in the backend under name i did homeassistant_main for homeassistant and homeassistant_backup for homeassistant2

                                  We are not talking about the real servers here, it is the name you want to use to access the home assistant via HAproxy.
                                  I guess, this should be homeassistant. So go into your DNS settings and point it to pfSense LAN IP.

                                  C 1 Reply Last reply Reply Quote 0
                                  • C
                                    comet424 @viragomann
                                    last edited by

                                    @viragomann
                                    ya the youtube video doesnt use localhost.. they change from WAN to LAN they say to use LAN for frontend they never talk about using localhost

                                    ya i had it set to LAN thats where you get the 503 error

                                    but ok ill re add the dns setting to point to 192.168.0.1 and 53 as the port right?

                                    and i dont know what you mean a forward to localhost..

                                    like i say i need pictures screen shots words dont always help me if dont understand what im visually seeing

                                    but ill keep looking.. sorry not fast realizer im just a visual learning and detail explaination of each field to someone that is learning in school say..

                                    i do appreciate the help so far.. thats why i asked for screen shots of what should i have in the fields

                                    V 1 Reply Last reply Reply Quote 0
                                    • V
                                      viragomann @comet424
                                      last edited by

                                      @comet424 said in can you setup a fail over for say Homeassistant like 2 Ips 1 domain name?:

                                      but ok ill re add the dns setting to point to 192.168.0.1 and 53 as the port right?

                                      This was a DNS server setting in HAproxy. No, not there. I was talking about your local DNS server.

                                      You say, homeassistant is resolved to the main server in your local network. So you're running a local DNS server and have set an override for this name, I guess. Or how does this work?
                                      Probably you're running the DNS Resolver on pfSense for DNS resolution.
                                      If so go to the Resolver page and update the host override entry and point it to the LAN IP.

                                      BTW: "homeassistant" is not a really proper host name. You should attach a domain to it. E.g. "homeassistant.home". So home would be your local domain.

                                      You don't need port forwardings, but you would need to allow access to the LAN IP on the other interfaces if you want to allow access to the home assistant from connected devices.

                                      I cannot provide screenshots, I haven't HAproxy installed at home.

                                      C 1 Reply Last reply Reply Quote 0
                                      • C
                                        comet424 @viragomann
                                        last edited by

                                        @viragomann
                                        so how my home assistant works is

                                        pfsense === >dhcp ===> (main server)unraid server(HA VM) gets 192.168.0.12 and has the hostname homeassistant inside the software
                                        pfsense === >dhcp ===> (backup server)unraid server(HA VM) gets 192.168.0.10 and has the hostname homeassistant2 inside the software

                                        i dont do host override etc
                                        and thats how i access home assistant
                                        http://192.168.0.12:8123 or http://homeassistant:8123

                                        ok i set the host over ride to homeassistant.home in the dns resolver
                                        issure1.JPG

                                        1 Reply Last reply Reply Quote 0
                                        • First post
                                          Last post
                                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.