Re: [Hampshire] IP address translation

Top Page

Reply to this message
Author: James Bensley
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] IP address translation
On 30 January 2012 15:49, James Courtier-Dutton <james.dutton@???> wrote:
> Hi,
>
> I understand how to do network address and port translation in Linux
> in a many to one type setup that you might normally get on a ADSL
> line.
>
> What I have not done before is network address translation but
> preserving the port numbers.
> So, if the private side of the box is 192.168.1.0/24
> and the public side of the box should make the private side look like
> 158.153.1.0/24, how is this done in Linux.
> E.g.
> Private PC on 192.168.1.1 sends a packet with source address
> 192.168.1.1, source port 12000, destination port 80.
> Public side sees a session coming from 158.152.1.1 source port 12000,
> destination port 80.
>
> Private PC on 192.168.1.2 sends a packet with source address
> 192.168.1.2, source port 12000, destination port 80.
> Public side sees a session coming from 158.152.1.2 source port 12000,
> destination port 80.
> etc. for each PC on the private network.
>
> As you can see, only the IP address is getting translated. The port
> numbers are preserved.
>
> Has anyone tried this on Linux?
> Does it work?
>
> Kind regards
>
> James


Are you referring to dynamic pools per chance?
http://lists.netfilter.org/pipermail/netfilter/2001-March/008924.html

This is an example of mapping 192.168.1.0/24 to another /24 but
dynamically, so 192.168.1.17 might not become 10.0.0.17, it might
become 10.0.0.33. Otherwise you need static pools or some sort of NAT
masquerading with 1:1 NAT.

--
James.
http://www.jamesbensley.co.cc/

--
Please post to: Hampshire@???
Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire
LUG URL: http://www.hantslug.org.uk
--------------------------------------------------------------