Hi all,

I have a network with two gateways. GW1 is primary gateway and GW2 is
secondary.
I need to be able to map GW2 port to a service inside of my network. That
is done using redirect_port NAT directive but the problem is that all
computers inside the network have a default gateway pointing to GW1 so
returning packets are routed through GW1 and the goal is not achieved.

So the solution to this situation is a second NAT instance on GW2
masquarading sender IP address with the internal address of GW2.

Here is the picture.


Internet
     |
     |
     | em0 (a.b.c.d)
 GW2
     | em1 (192.168.0.2)
     |
     |
     | 192.168.0.111
Service


So basicly what comes into mind:

ipfw nat 1 config ip a.b.c.d redirect_port 192.168.0.111:80 80
ipfw nat 2 config ip 192.168.0.2

...
ipfw add 300 nat 1 all from any to any via em0
ipfw add 301 nat 2 all from any to 192.168.0.111 80 out via em1
ipfw add 302 nat 2 all from 92.168.0.111 80 to me in  via em1
...

I have given an example (which will probably not work) just to give a basic
idea of how can the goal be achieved.

But here we meet something unexpected. When the packets are passed to nat 2
they probably meet already existing entry formed by nat 1 and no actual
action is performed.
I have been struggling against a wall to make this work but could not get
it working thist way.
But one day I tried replacing nat 2 instance with natd daemon divert and
everything instantly started working.
So it seems ipfw nat instances share the same aliasing table like it should
do when using global option.

IMO this should be fixed.

P.S. Maybe I was missing some unclear option to prevent this from happening?
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to