Network client is the same from server

Brian Candler B.Candler at pobox.com
Tue Jan 31 04:30:49 PST 2006


On Mon, Jan 30, 2006 at 10:51:28AM -0800, Julian Elischer wrote:
> Tiago Cruz wrote:
> 
> >On Fri, 2006-01-27 at 13:19 -0800, Julian Elischer wrote:
> >
> > 
> >
> >>it is definitly possible
> >>but you will have to do some reading
> >>natd can do it.
> >>   
> >>
> 
> it should be in the natd man page.. (or libalias page)

Maybe, but it's not very clear though.

I think he needs to NAT destination addresses as well as source addresses,
and statically map a whole /24 to another /24. Put diagramatically:

   192.168.0.0/24                                 192.168.0.0/24
  ------+---------- GW1 -------------------- GW2 -----+----------- 
        |                                             |
        X                                             Y

In order to allow X (say 192.168.0.1) to communicate with Y (say also
192.168.0.1), then we need to map both address ranges into new space.
Let's say we use 192.168.100.0/24 for the first network and 192.168.200.0/24
for the second network. Then the connection from X to Y will appear to be
from 192.168.100.1 to 192.168.200.1 when viewed on the middle wire.

So at GW1, *outbound* packets from 192.168.0.X to 192.168.200.Y need to have
their *source* IP mapped to 192.168.100.X

At GW2, *inbound* packets from anywhere to 192.168.200.Y need to have their
*destination* IP mapped to 192.168.0.Y

Plus the mirror: at GW2, outbound packets from 192.168.0.X to 192.168.100.Y
need to have their source IP mapped to 192.168.200.X; at GW1, inbound
packets from anywhere to 192.168.100.Y need to have their destination IP
mapped to 192.168.0.Y

The only way I can see to do this with natd is with 254 separate
-redirect_address rules. On GW1 you'd need

  -redirect_address 192.168.0.1 192.168.100.1
  -redirect_address 192.168.0.2 192.168.100.2
  ...

and on GW2 you'd need

  -redirect_address 192.168.0.1 192.168.200.1
  -redirect_address 192.168.0.2 192.168.200.2
  ...

Brian.


More information about the freebsd-net mailing list