All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mihai Tanasescu <mihai@duras.ro>
To: netfilter@vger.kernel.org
Subject: Basic dummy iptables SNAT multiple IPs algorithm question
Date: Fri, 10 Feb 2012 15:46:58 +0100	[thread overview]
Message-ID: <4F352DE2.4040106@duras.ro> (raw)

Hi guys,

I've been using iptables and some of the modules it comes with for a
while now but only recently as I stumbled into a big NAT444 setup, did I
reach the point at which I'd like to find an answer to a theoretical
question.

I wanted to ask:
If I have a rule that says:
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.0/16 -j SNAT --to
20.20.20.1-20.20.20.22.254

Then how are the IPs from the private pool distributed to the ones from
the public pool in the two following cases:
- with persistent
- with random

Is it a simple mathematical thing like:
if private pool has X IPs ( 65536 in this case) and public Pool (Y) has
let's say 766 IPs in theory =>  X / Y = aprox 85 private IPs per public
IP and then:
- 192.168.0.0-84 =>  20.20.20.1
- 192.168.0.85-169 =>  20.20.20.2
and so on ?
or does this depend on the number of IPs which are online and the
algorithm is a bit more complex ?

Also, what happens in case random is being used to the same algorithm ?

Hope I'm not troubling you too much with theory related questions.

Thanks,
Mihai


                 reply	other threads:[~2012-02-10 14:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F352DE2.4040106@duras.ro \
    --to=mihai@duras.ro \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.