Hi,
based to the given port number, I want to redirect an external call to my
public IP to different web servers (they listen locally to port 80!) located
inside my LAN. For example:
IP:8000 --> 192.168.1.100 (on port 80!)
IP:8001 --> 192.168.1.101 (on port 80!)
when I try the above, pf is blocking the attempt cause it assumes that I try
to contact port 8000!! Here is the message in the pflog:
---------------
May 12 20:59:29.037940 rule 1/0(match): block in on vr0: "my public IP".36301
> 192.168.1.100.8000: S 3613123794:3613123794(0) win 5840 <mss
1460,sackOK,timestamp[|tcp]> (DF)
--------------
Why is that?
here is my pf.conf:
---------------------------
ext_if="vr0"
int_if="rl0"
tcp_services = "{ 80, 20, 21, 22, 25, 110, 113, 8000 }"
icmp_types = "echoreq"
priv_nets = "{ 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8 }"
cam1 = "192.168.1.100"
set block-policy return
set loginterface $ext_if
scrub in all
nat on $ext_if from $int_if:network to any -> $ext_if
rdr on $int_if proto tcp from any to any port 21 -> 127.0.0.1 port 8021
rdr on $ext_if proto tcp from any to any port 8000 -> $cam1
block all
block in log all
pass quick on lo0 all
block drop in quick on $ext_if from $priv_nets to any
block drop out quick on $ext_if from any to $priv_nets
pass in on $ext_if inet proto tcp from any to ($ext_if) \
port $tcp_services flags S/SA keep state
pass in on $ext_if proto tcp from any to $cam1 port 80 keep state
pass in inet proto icmp all icmp-type $icmp_types keep state
pass in on $int_if from $int_if:network to any keep state
pass out on $int_if from any to $int_if:network keep state
pass out on $ext_if proto tcp all modulate state flags S/SA
pass out on $ext_if proto { udp, icmp } all keep state
----------------------------------------------
Thanks