port fowarding with IP fallback reddit / selfhosted ---------------------------------------------------------------------- bebewold · 2023-10-27 04:05 I'm still a beginner when it comes to selfhosting so my question might sound obvious to some but here it is anyway # My setup so right now I have a server with 2 IP, one for the ethernet connexion and another for my wireless connnexion. The other day my server was not available on the web and it was because the cable got loose and disconnected. I'll replace it but it lead me to a question... # The question Is there a way to have a port fowarding rule that fallback to another IP if the first one is down? My router is provided by my ISP so i doubt i got the option to do that but is there a firewall that could do something like this? ## High Availability I can see this being used in high availability setup where instead of having two IP on one server like me you would loadbalance the port between 2 server so I suppose it might exist. Maybe on something like pfsense or opnsense? I'm thinking about upgraping my firewall lately so if there's something like that i might finally make the switch... ---------------------------------------------------------------------- IPv6_Dvorak · 2023-10-27 04:08 It’s better to use IPv6 so that you don’t have to deal with port forwarding and a lack of IP address space. ---------------------------------------------------------------------- No_Dragonfruit_5882 · 2023-10-27 04:18 Seems like this issue is about local Networks, i dont think ipv6 is needed in a homenet ---------------------------------------------------------------------- No_Dragonfruit_5882 · 2023-10-27 04:22 What you are looking for is a reverseproxy (maybe haproxy with opnsense) You configure your Frontend to your public ip and for the backend you have backend 1 with priority 1 and lan address and backend 2 with priority 2 for your wifi address. Haproxy will automatically either do a fallback (what you described) Or a loadbalancing (distributing the requests to different servers) It can do ssl termination aswell and got acme support, which is a really neat way to configure certificates for all your sites in one Spot. Just expose the http Service in your local network, turn on ssl termination and you got a https service ---------------------------------------------------------------------- bebewold · 2023-10-27 04:32 I've actually got a reverse proxy already, I'm using traefik with docker an I'm trying to use both IP to link to it Just to be sure I understand correctly, is HAproxy running on open sense or would it need to run on a separate machine? I'm just trying to find a way to have a redundant connection between my port forwarding and my reverse proxy, and if HAproxy run directly on the firewall it might be my solution ---------------------------------------------------------------------- bebewold · 2023-10-27 04:36 To be honest, I never tried to understand IPv6 so I'm not sure if that would solve it or not but you got me curious so it's time to learn about how IPv6 works ! ---------------------------------------------------------------------- IPv6_Dvorak · 2023-10-27 04:36 You don’t need “high availability“ either, yet here we are. 🤷 ---------------------------------------------------------------------- bebewold · 2023-10-27 04:38 I'm mostly trying to learn, it's not really about what I need at this point. ---------------------------------------------------------------------- IPv6_Dvorak · 2023-10-27 04:39 Exactly, so you might as well start with something simpler, easier, and better. ---------------------------------------------------------------------- bebewold · 2023-10-27 04:44 So what do you propose then? My question was only about having 2 connection between my forwarded port and my server... What would be a more simple way to achieve that? ---------------------------------------------------------------------- IPv6_Dvorak · 2023-10-27 04:48 The simplest thing to do would be to use the other IP address when one is inaccessible. You don’t need port forwarding when you have direct access. ---------------------------------------------------------------------- bebewold · 2023-10-27 05:06 I have direct access when I'm at home when but for example I'm running a home assistant container at home which is configure to link with Google Home to read. And modify the status of my smart devices.... And it happened a couple of time that either my wifi connection or my Ethernet one failed. I just think it would be simpler if I could rely on both since I got both? Doing things manually sure is simpler but it doesn't make things easy to use ---------------------------------------------------------------------- elightcap · 2023-10-27 05:56 Your reverse proxy would go behind the firewall, and then route the inbound traffic based on the availability. ---------------------------------------------------------------------- [deleted] · 2023-10-27 08:28 [removed] ---------------------------------------------------------------------- thekrautboy · 2023-10-27 11:56 If the reverse proxy with high availability doesnt work out for you for whatever reasons, take a look at [keepalived](https://www.keepalived.org/) as a alternative. You run it on listening on both IPs and once one is detected as being down, the other takes over automatically. Very easy to set up. iirc techno tim made a youtube video about it some time ago, or someone else, but easy to find i guess. ---------------------------------------------------------------------- No_Dragonfruit_5882 · 2023-10-27 13:24 Bro. Nice Bro. Zero advice given in 4 Comments. Good ---------------------------------------------------------------------- IPv6_Dvorak · 2023-10-27 15:25 Fuck off. ---------------------------------------------------------------------- No_Dragonfruit_5882 · 2023-10-27 16:29 Haproxy can run standalone but in the opnsense its all in one package with a sweet Firewall. Maybe a little too much tho ---------------------------------------------------------------------- No_Dragonfruit_5882 · 2023-10-27 16:29 Keep going with your ipv6 shit fanboy. Get your shit away from home Networks lol ---------------------------------------------------------------------- bebewold · 2023-10-27 20:40 Yes I think It'd be better in the opnsense for what I want to do, since if I run HAproxy has a standalone I would end up with the same problem I sometime get with traefik, since they're both reverse proxy ---------------------------------------------------------------------- bebewold · 2023-10-27 20:43 Oh I haven't seen that one, I watched a couple of his video already that's what got me started with traefik so I'll see what keepalived can do, thank you ---------------------------------------------------------------------- bebewold · 2023-10-27 21:07 I just looked at it and that's probably the solution I'm going to go with. With the vIP I wouldn't need to upgrade my router yet so it's something I can implement right now. I just need to figure out how to set it up in one machine instead of 2 but that definitely sounds like my solution