Index | Thread | Search

From:
aisha <openbsd.tech@aisha.cc>
Subject:
relayd.conf(5) - add "route to" example
To:
tech@openbsd.org
Date:
Wed, 18 Sep 2024 22:53:56 -0400

Download raw body.

Thread
Hi,

  I was trying to figure out how to load balance using route-to with relayd and turns out it was complicated due to unhelpful error warnings (thanks yacc/lex) and lack of an example. I had to read the parse.y to figure out the problem. 
While fixing yacc/lex errors is above my mortal soul, I can add an example for the route-to syntax.

OK?

Best,
Aisha

--- relayd.conf.5.orig	Wed Sep 18 22:35:35 2024
+++ relayd.conf.5	Wed Sep 18 22:48:05 2024
@@ -1529,6 +1529,20 @@
 }
 .Ed
 .Pp
+To load balance an IP address over multiple backend servers using a
+.Xr pf 4
+.Cm route-to
+directive:
+.Bd -literal -offset indent
+table <backends> { 10.100.42.71 10.100.42.72 10.100.42.73 }
+
+redirect "xmpp" {
+	listen on 10.100.42.2 tcp port 5222
+
+	route to <backends> port 5222 check tcp interface em0
+}
+.Ed
+.Pp
 The following configuration would add a relay to forward
 secure HTTPS connections to a pool of HTTP webservers
 using the