From: Marc SCHAEFER <schaefer@alphanet.ch>
To: netfilter@vger.kernel.org
Subject: IP SNAT in a bridge
Date: Thu, 3 Mar 2022 21:45:46 +0100 [thread overview]
Message-ID: <20220303204545.GA6798@alphanet.ch> (raw)
Hello,
I have two containers connected to a bridge. Let's assume the following
IP packet goes through the bridge:
192.168.101.3:80 > 192.168.101.4:12345
I would like to change the packet as follows:
1.2.3.4:80 > 192.168.101.4:12345
am I right that this has to be done as a -t nat POSTROUTING -j SNAT
iptables, but that will only work if ebtables forces the packet into
BROUTE mode first?
Something like:
ebtables -t broute -I BROUTING -p 0x800 -i bridge \
--ip-proto tcp --ip-sport 80 --ip-src 192.168.101.3/32 \
-j DROP
iptables -t nat -I POSTROUTING -s 192.168.101.3/32 -p tcp --sport 80 \
-j SNAT --to-source 1.2.3.4:80
Or am I completely mistaken?
Thank you.
next reply other threads:[~2022-03-03 20:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-03 20:45 Marc SCHAEFER [this message]
2022-03-04 8:10 ` IP SNAT in a bridge Marc SCHAEFER
2022-03-04 14:25 ` Marc SCHAEFER
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=20220303204545.GA6798@alphanet.ch \
--to=schaefer@alphanet.ch \
--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