Example rule: rdr from any to $public_ip port http -> <webservers>
Parent Process
HCE: Host check engine
PFE: PF Engine
Relay Engine
In pf.conf
rdr-anchor "hoststated/*"
In hoststated.conf
public_addr=81.81.81.81
webhost1=10.1.1.100
webhost2=10.1.1.101
table webhosts {
	real port http
	check http "/" code 200
	host $webhost1
	host $webhost2
}
service www {
	virtual host $public_addr port http interface trunk0
	table webhosts
}
# hoststatectl show summary Type Id Name Avlblty Status service 0 www active table 0 webhosts active (2 hosts up) host 1 10.1.100.2 100.00% up host 0 10.1.100.1 100.00% up
checking methods
other options
+table sorry_server {
+       check icmp
+       host 127.0.0.1
+}
+
 service www {
         virtual host $public_addr port http interface trunk0
         table webhosts
+       backup table sorry_server
 }
result in hoststatectl's output:
Type Id Name Avlblty Status service 0 www active (using backup table) table 0 webhosts empty host 1 10.1.1.101 0.00% down host 0 10.1.1.100 0.00% down table 2 sorry_server:80 active (1 hosts up) host 3 127.0.0.1 100.00% up
Forcible disabling of hosts is useful for maintenance updates
# hoststatectl table disable webhosts:80 command succeeded # hoststatectl show su Type Id Name Avlblty Status service 0 www active (using backup table) table 2 webhosts:80 disabled table 3 sorry_server:80 active (1 hosts up) host 5 127.0.0.1 100.00% up
Generic UDP relaying can not be achieved due to the stateless datagram based nature of the protocol.
ext_addr="172.16.1.1"
webhost1="10.1.1.100"
webhost2="10.1.1.101"
table webhosts {
        check http "/" code 200
        host $webhost1
        host $webhost2
}
protocol http {
        protocol http
        header append "$REMOTE_ADDR" to "X-Forwarded-For"
        header append "$SERVER_ADDR:$SERVER_PORT" to "X-Forwarded-By"
        header change "Connection" to "close"
}
relay wwwssl {
        listen on $ext_addr port http
        protocol http
        table webhosts loadbalance
}
TCP
SSL