i need to do a setting a bit unusual.

I have 3 machines with public Ips. I want to use one of them as a load balancer for the 2 others.

My machine >> machine1 who redirect the connection to machine 2 or 3.

If machine1 has 1 private ip on a network card and another network card with a public ip it work without any problem using very simple rules like :

  • 1
    umm... like what? – xenoterracide Jun 25 '11 at 5:29
  • Please add more details and clarify the question or suggest it for deletion. The quality is so low as to be unhelpful for others searching for pf help. – polynomial Sep 23 '11 at 6:58

I'm having a hard time understanding exactly what you want to do here... a network diagram and more detail would be extremely helpful. To redirect traffic using pf you need to use the rdr-to directive.

Here's an example where I'm redirecting traffic through my firewall to my webserver on the other side:

# redirect external web traffic to darkstat
pass in log on $ext_if inet proto tcp to ($ext_if) port 8080 \
rdr-to port 80

(I'm using NAT so these rules look a little different than if you were just matching and redirecting ingress traffic... see the manpage for details).

To do basic Layer-3/4 load balancing you might try something like this. If you need a Layer-7 aware approach consider using relayd.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.