notes from my findings:
1. relay can not do udp layer7 relaying besides "special case" dns
2. despite other information on the net (relayd would do udp + tcp when using for dns relay) it does not work with tcp for me when using dns config option
3. you can configure relayd to do layer7 relaying for port 53 for udp AND for tcp the following way:
@@
#https://de.slideshare.net/MenandMice/dns-highavailability-tools-opensource-load-balancing-solutions
table <dnsserver> { 192.168.1.80 }
dns protocol "dnsproto" {
tcp { nodelay, sack, socket buffer 1024, backlog 1000 }
}
relay dnsproxy-tcp {
listen on 192.168.1.52 port 53
forward to <dnsserver> port 53 check tcp
}
relay dnsproxy-udp {
listen on 192.168.1.52 port 53
protocol "dnsproto"
forward to <dnsserver> port 53 check tcp
}
@@
apparently, protocol "dnsproto" adds some "listen udp magic" here, i`m curious why we can“t have "listen on .... proto udp|tcp port 53" here like possible with "redirect" configuration
if i stop pfsense loadbalancer and start relayd manually (relayd -vv -d -f /root/relayd7.conf), i can verify THIS config actually works.
proof as follows:
udp query:
dig @192.168.1.52 rs.dns-oarc.net txt -> works for me. you see dig switching to tcp because of large response
tcp query:
dig +tcp @192.168.1.52 rs.dns-oarc.net txt -> works for me
one problem remains:
pfsense don`t let you add virtual service of type "relay" (layer 7) as it defaults to type "redirect", which is layer3 which is not want you want, especially in this case where mixing layer3 and layer7 loadbalancing for the same port absolutely makes no sense.
i can currently workaround this issue with this change in pfsense installation:
@
diff -Naur vslb.inc vslb.inc.orig
--- vslb.inc 2017-03-08 13:05:36.778431000 +0100
+++ vslb.inc.orig 2017-03-08 13:05:23.523895000 +0100
@ -357,7 +357,7 @
}
$conf .= "}\n";
} else {
- $conf .= "relay \"{$name}\" {\n";
+ $conf .= "redirect \"{$name}\" {\n";
$conf .= " listen on {$ip} port {$src_port}\n";
$conf .= " forward to <{$vs_a[$i]['poolname']}> port {$dest_port} {$check_a[$pools[$vs_a[$i]['poolname']]['monitor']]} \n";
@
i would suggest to enhance pfsense load balancer configuration for providing more options for configuration or to override gui configuration by manual configuration.
i would like to use pfsense+relayd because we have a pfsense carp/ha setup and i don`t like to build another cluster just for making dns highly available