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.
    • C
      comet424 @viragomann
      last edited by

      @viragomann

      not a 100% what you mean.... as i not fluent in pfsense just simple home user...

      but i installed the haproxy and setup backend but not working by homeassistant name
      not sure what else i need to do .. tried a couple youtube video but got confused but here is some screen shots
      pfhome1.JPG pfhome2.JPG

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

        Do you have a front end pointing to it?

        What name are you trying to use? Does it resolve to an IP HAProxy is listening on?

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

          @stephenw10

          no i dont have a front end setup didnt know i had to..

          i just going from what @viragomann said about backend

          what i trying to do is have 2 Home Assistant VMs clones
          main at
          192.168.0.12

          and backup at 192.168.0.10

          and what i want is like
          http://homeassistant:8123 and it will go to the main one but if the main one it goes down due to server reboot it will flip to the backup running on a backupserver
          or even use like
          http://homesystem or http://homeassistant without the port but it know to go to 8123

          so i wanted like
          that carp fail over for pfsense of if microsoft.com goes down on 1 server another one will pick up the slack
          least thats what i trying to do at home

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

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

            In the frontend you configure, which IP and port HAproxy is listening and to which backend the connection should be forwarded.

            So set up a fronted for listening to a proper interface address and port 8123. Select the homeassistant backend as default backend.

            and what i want is like
            http://homeassistant:8123 and it will go to the main one but if the main one it goes down due to server reboot it will flip to the backup running on a backupserver

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

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

              @viragomann ok ill give it a try i was getting confused

              so did i do the backend correctly? or was it wrong what i did... ill give it a try the front again

              or is it

              front end is main home assistant
              backend is the backup home assistant

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

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

                front end is main home assistant
                backend is the backup home assistant

                ?
                You want HAproxy to forward all requests to the main home assistant, expect if it's down, then the requests should go to the backup.
                So edit the backup in the backend and set the type to "backup".
                Actually both are "active". With this setting HAproxy does load balancing, i.e. the first request is sent to main, the second to backup and so on.

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

                  looks like i buggered it up i got a bind error?
                  so i guess i did it wrong

                  errorP1.JPG errorp2.JPG errorp3.JPG

                  errorp4.JPG

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

                    @comet424
                    The frontend must listen on an interface address of pfSense, as I mentioned above twice.

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

                      @viragomann

                      if you mean the listem address

                      i changed that to custom as i couldnt get the 192.168.0.12 or is this how it should look

                      z1.JPG z2.JPG

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

                        @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.

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

                          @viragomann
                          ok i lost

                          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

                          i said i changed the front end localhost to custom cuz thats where i want 192.168.0.12 main home assistant
                          but you said i did it wrong so i put it to the backend

                          so the main home assistant is Active and the backup home assistant is backup
                          cuz there is no main....

                          i need it explained simpllified like if you were teaching high school student.. cuz with learning disiability i not understanding 100%

                          so should it look like this then cuz i not grasping it yet fully i a visual learning not so much with words

                          x1.JPG x2.JPG x3.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?:

                            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
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.