# NAT from WAN to LAN



## vadim64 (Mar 2, 2011)

Hi, all!

Does any manner to do this construction by using IPFS kernel NAT:

System A
em0 - WAN-interface, 207.46.197.32
em1 - LAN-interface, 192.168.1.1/27

System B
rl0 - LAN-interface, 192.168.1.2/27, has no route to 0.0.0.0, only to 192.168.1.0/27

IP-packet from address 32.197.46.207 and dest-port 1234 goes from WAN-interface em0 of system A.
IPFW kernel NAT(may be more than one instance) set source address of packet 192.168.1.1 and set dest-port 4321.
The packet goes from 192.168.1.1 to 192.168.1.2
Some service on 4321 port on System B do something and send answer to 192.168.1.1.
Answer packet goes from LAN-interface to system B.
IPFW kernel NAT dealiasing primal source address and port and send packet to 32.197.46.207 from 207.46.197.32

In this moment I don't know the application for this task, but I very want to find solution. Does anybody direct me to right way or give me some advise


----------



## vadim64 (Mar 3, 2011)

Silence... May be I'm use wrong words... I try to do something like rinetd, but on ipfw. There is function LibAliasProxyRule() in libalias sources. But I can't find any interface to this in ipfw commands.


----------



## SirDice (Mar 3, 2011)

Look at the -redirect_port option of natd(8).


----------



## vadim64 (Mar 3, 2011)

Mmm... I don't think about this way by to reasons:
1. Kernel NAT is more progressive and orthodox technology, I believe.
2. Does this option set source ip to that I need? Or I must use two instance of NATD?


----------

