I'm trying to configure pf port forwarding on OpenBSD 5.0
The firewall machine has two nics:
em0: 192.168.200.3 vic0: 192.65.214.136
I would like to forward all packets comming into 192.168.200.3:104 to 192.65.214.131:104. Also I need to still have access to port 22, for ssh.
So far, the rules I've setup are as this:
set skip on lo
pass in log on em0 proto tcp from any to any port 104 rdr-to 192.65.214.131
# By default, do not permit remote connections to X11
block in on ! lo0 proto tcp to port 6000:6010
By reading the log using tcpdump -n -e -ttt -r /var/log/pflog, I see thar rule 0 is matched, but the calling application does not receives the acknowledge it is expecting.
What I'm doing wrong?.
BTW. I can ping and telnet to 192.65.214.131.
Edit: Here's the new /etc/pf.conf, now it works. Thanks Falcon.
set skip on lo
pass in log on em0 proto tcp from any to any port 104 rdr-to 192.65.214.131
pass out on vic0 from em0:network to any nat-to vic0
# By default, do not permit remote connections to X11
block in on ! lo0 proto tcp to port 6000:6010
Edit: Mm, the nat-to rule only works when packets are sent from 192.168.200.x, but some packets are sent from 192.168.7.xxx, how can I allow those too?.
Thanks in advance, Leonardo.