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
      You can do this with the HAproxy package. You can add both home assistant VMs to a backend, either both active or one as backup.
      Then you have to send the packets to pfSense instead of to the VMs directly.

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

        @viragomann
        ok ill install that and try it... and how do you send the packets directly pfsense instead of the vms

        is that
        accessing by "homeassistant" or do you need to
        say
        192.168.0.1:8123 and using that port would forward with haproxy... but ill download that later today when im home and take a look

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

          @comet424
          To access the home assistant point the client to pfSense instead of the VM.
          You can also change the home assistant VMs IPs to something else and assign their original IPs to pfSense. So no changes on the clients is needed.

          A point to consider is that going over HAproxy replaces the client IP with pfSense IP. So the server doesn't know the real client IP anymore. Maybe this is an issue.

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