I have tried this a few different ways. Currently trying with pf on freebsd 8.2
I am trying to insert a nat solution into an existing network that will redirect traffic from an outside ip address to an inside ip address on all ports (static nat) but I also want to translate the source address.
hosta 192.168.1.2/24 gw 192.168.1.1/24 outsidehost 10.0.0.1/24 natbox em0 192.168.1.3/24 (used to manage the box) em1 10.0.0.2/24 (outside address same lan as outsidehost) em0_alias0 192.168.1.4/24 (inside address same lan as hosta) route 192.168.1.0/24 192.168.1.1 route 0.0.0.0 0.0.0.0 10.0.0.1
I want outsidehost to be able to telnet to 192.168.1.3 by telneting(sp) to 10.0.0.2
For this to work I assume I will have to change the source of the packet as it leaves em0 or it will get lost on the way back to em1.
So the flow goes like this:
- from outsidehost telnet 10.0.0.2
- change source address to 192.168.1.4
- redirect traffic for 10.0.0.2 to 192.168.1.2
- the packet leaves with src 192.168.1.4 goes to 192.168.1.2 then gets sent back to 192.168.1.4 translates back to whatever the source addy was in this case 10.0.0.1
I keep thinking this can be done with
binat and rdr but I can't figure out the syntax.
How can I get this done?