Subject: Re: Problems with NAT
To: None <netbsd-users@netbsd.org>
From: Rafael Almeida <almeidaraf@gmail.com>
List: netbsd-users
Date: 08/28/2006 18:05:03
Hello,

I've posted before in this same thread. I'm having trouble doing a
port redirection in a nat. I redirect some ports for playing starcraft
on a windows box, but the game gets very laggy when there's more than
one person in the game, and my messages don't get to players other
than the creator of the game. I used to have a linux box as a gateway
and this iptables rule was enough to get everything working:

/usr/sbin/iptables -t nat -A PREROUTING -p udp --dport 6112:6119 -i
ppp0 -j DNAT --to 192.168.0.3

I've been told to use pf instead of ipf and ipnat. So I did a little
reading and I was able to come up with the following pf.conf:

ext_if="pppoe0"
int_if="mtd0"

scrub out all max-mss 1440

nat on $ext_if from !($ext_if) -> ($ext_if:0)
rdr pass on $ext_if proto { tcp, udp } to port 6112:6119 -> 192.168.0.3
rdr pass on $ext_if proto tcp to port 4662 -> 192.168.0.2
rdr pass on $ext_if proto udp to port 4672 -> 192.168.0.2

pass in all
pass out all

Note also that 4662 and 4672 are ports for emule. Surprisingly (at
least to me), when I had

rdr pppoe0 0.0.0.0/0 port 4672 -> 192.168.0.2 port 4672 udp

on my ipnat.conf everything worked fine for the emule, but now it says
that port is firewalled, even though I configured pf to send it back
to my other computer.

Thanks in advance to anyone who tries to help me with those configurations.