netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: carlopmart <carlopmart@gmail.com>
To: netfilter@vger.kernel.org
Subject: Re: Using source nat to discriminate traffic
Date: Tue, 26 Apr 2011 11:45:44 +0200	[thread overview]
Message-ID: <4DB69448.6080009@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.01.1104261115080.20267@obet.zrqbmnf.qr>

On 04/26/2011 11:15 AM, Jan Engelhardt wrote:
> On Tuesday 2011-04-26 11:07, carlopmart wrote:
>
>> Hi all,
>>
>> I have a problem using source nat rules to discriminate traffic on one host.
>> This host has several ip aliases assigned to provide several services. Problem
>> starts with mysql client. This host needs to access to another host that acts
>> as MySQL server. This MySQL server has some acls configured to access
>> databases, in this manner:
>>
>> - BBDD_1 can only be accessed by ip address 172.21.2.2.
>> - BBDD_2 can only be accessed by ip address 172.21.2.3
>>
>> Both ip address, 172.21.2.2 and 172.21.2.3, are assigned to the first host
>> that acts as a mysql client. Latest release of mysql client contains an option
>> to pass --bind-ip-address, but my mysql client version not (and I can't do an
>> upgrade due to a tecnical specifications).
>>
>> Then, I need to discrimanate traffic on mysql host client when it tries to
>> access to mysql server. I have found a partial solution putting this iptables
>> rule:
>>
>> iptables -t nat -A POSTROUTING -o eth1 -d 172.17.3.3 -p tcp --dport 3306 -j
>> SNAT --to-source 172.21.2.2
>>
>> This rule works ok when mysql client tries to access to BBDD_1
>
> Assuming BBDD_1 is 172.17.3.2, this rule won't be considered at all. Of
> course stuff works because some address is the client's default.

MySQL host ip address is 172.17.3.3, always, to all BBDD.

-- 
CL Martinez
carlopmart {at} gmail {d0t} com

  reply	other threads:[~2011-04-26  9:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-26  9:07 Using source nat to discriminate traffic carlopmart
2011-04-26  9:15 ` Jan Engelhardt
2011-04-26  9:45   ` carlopmart [this message]
2011-04-26 12:02 ` Vigneswaran R
2011-04-26 12:42   ` carlopmart
2011-04-27  5:37     ` Vigneswaran R

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=4DB69448.6080009@gmail.com \
    --to=carlopmart@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).