I tried the two lines (added CIDR notation):
rdr fxp0 10.20.50.1/32 -> 172.168.50.1/32
map fxp1 192.168.0.0/24 -> 172.16.1.1/32

freebsd# ipnat -FC -f /etc/ipnat.rules
1: missing fields - 1st port
1: syntax error in "rdr"

Appears rdr requires a port definition, but I need all ports to be
redirected; is this possible, or is there a reference describing all
available parameters for rdr definitions (source code may take awhile
for me to read)?  

Threw lots of trial & error, I did get this to work:
bimap fxp0 172.16.50.1/32 -> 10.20.50.1/32
map fxp4 192.168.0.199/32 -> 172.16.1.1/32

But, I can't explain why it works, the bimap line seems backwards to me
(I want to have confidence this is going to scale to 1000s of entries). 
If I change the bimap line to fxp4, or reverse the IP -> IP entries,
this is what happens:

> traceroute -I -n 10.20.50.1
traceroute to 10.20.50.1 (10.20.50.1), 30 hops max, 38 byte packets
 1  192.168.0.1  0.765 ms  0.530 ms  0.281 ms
 2  10.20.0.1  0.847 ms  0.307 ms  0.298 ms
 3  10.20.0.1  0.332 ms  0.971 ms  0.291 ms
 4  10.20.0.1  0.329 ms  0.330 ms  0.382 ms
 5  10.20.0.1  0.363 ms  0.326 ms  0.424 ms
 6  10.20.0.1  0.334 ms  0.309 ms  0.364 ms
... all the way to 30 (TTL expires)
-tate

On Wed, 2003-10-08 at 07:04, Guido van Rooij wrote:
> On Tue, Oct 07, 2003 at 02:31:03PM -0600, Tate Hansen wrote:
> > I have a FreeBSD box with two NICs configured like:
> > --------------fxp0 [freebsd] fxp1---------------
> > IP: 10.20.0.1                       IP: 172.16.1.1
> > 
> > I'm having trouble creating the proper NAT rules to perform the
> > following:
> > 
> > packets entering fxp0 with a source address of 192.168.0.0/24 destined
> > for 10.20.50.1 need to be translated before leaving fxp1 to source IP:
> > 172.16.1.1, destination IP: 172.168.50.1.
> >         
> > in a particular example:
> > --------------------------------
> > [192.168.0.199:10.20.50.1] enters fxp0
> > translation occurs...
> > [172.16.1.1:172.16.50.1] leaves fxp1
> > 
> > I want a one-to-one map for 10.20.50.1 <-> 172.168.50.1.
> > (setup proxy arp on [freebsd] for 10.20.50.1)
> 
> rdr fxp0 10.20.50.1 -> 172.168.50.1
> map fxp1 192.168.0.0/24 -> 172.16.1.1
> 
> -Guido

Reply via email to