* IP SNAT in a bridge
@ 2022-03-03 20:45 Marc SCHAEFER
2022-03-04 8:10 ` Marc SCHAEFER
0 siblings, 1 reply; 3+ messages in thread
From: Marc SCHAEFER @ 2022-03-03 20:45 UTC (permalink / raw)
To: netfilter
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.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: IP SNAT in a bridge 2022-03-03 20:45 IP SNAT in a bridge Marc SCHAEFER @ 2022-03-04 8:10 ` Marc SCHAEFER 2022-03-04 14:25 ` Marc SCHAEFER 0 siblings, 1 reply; 3+ messages in thread From: Marc SCHAEFER @ 2022-03-04 8:10 UTC (permalink / raw) To: netfilter Hello, On Thu, Mar 03, 2022 at 09:45:46PM +0100, Marc SCHAEFER wrote: > 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? I found out that if the br_netfilter module is loaded, it works without the BROUTE. I will investigate if there is a way to do it less globally. ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: IP SNAT in a bridge 2022-03-04 8:10 ` Marc SCHAEFER @ 2022-03-04 14:25 ` Marc SCHAEFER 0 siblings, 0 replies; 3+ messages in thread From: Marc SCHAEFER @ 2022-03-04 14:25 UTC (permalink / raw) To: netfilter On Fri, Mar 04, 2022 at 09:10:50AM +0100, Marc SCHAEFER wrote: > I found out that if the br_netfilter module is loaded, it works without > the BROUTE. I will investigate if there is a way to do it less globally. Apparently through ip link set dev BRIDGE type bridge nf_call_iptables 1 However, ebtables BROUTE seems incompatible with basic iptables (nft only). ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-04 14:25 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-03-03 20:45 IP SNAT in a bridge Marc SCHAEFER 2022-03-04 8:10 ` Marc SCHAEFER 2022-03-04 14:25 ` Marc SCHAEFER
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox