netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fwd: Linux bridge for route
       [not found] <CA+qZnSRGKiFh8FiKMpVQku7CiWCMPq47FpPwrawvTC6KBPwz7A@mail.gmail.com>
@ 2014-01-17  9:14 ` tingwei liu
  2014-01-17 20:30   ` Bart De Schuymer
  0 siblings, 1 reply; 3+ messages in thread
From: tingwei liu @ 2014-01-17  9:14 UTC (permalink / raw)
  To: netfilter-devel, netfilter, netdev; +Cc: tingwei liu

[-- Attachment #1: Type: text/plain, Size: 821 bytes --]

Dear all,

       There is  a question has puzzled me for a long time.
       You can find the topology from attachment.

       Normal traffic is:

               PC(192.168.1.8)--->Bridge(eth0)--->Bridget(eth1)--->NAT
server-->switch--->Server(192.168.5.3)

       Now I want the ssh traffic like this:
              PC(182.168.1.8)--->Bridge(eth0)--->eth2--->NAT
server--->switch--->Server(192.168.5.3)


      What I have done on LINUX Server:
              #net.bridge.bridge-nf-call-iptables = 1
              #iptables -t nat -A POSTROUTING -s 192.168.1.8 -p tcp
--dport 22 -j SNAT --to-source 192.168.5.2

      I have find the rule matched through command "iptables -t nat
-nvL", but the packets doesn't sent to 192.168.5.3.
      and "tcpdump -i eth2 tcp port 22" can not capture any packet!

Thanks very much!

[-- Attachment #2: topology.jpg --]
[-- Type: image/jpeg, Size: 84648 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fwd: Linux bridge for route
  2014-01-17  9:14 ` Fwd: Linux bridge for route tingwei liu
@ 2014-01-17 20:30   ` Bart De Schuymer
  2014-01-21  1:26     ` tingwei liu
  0 siblings, 1 reply; 3+ messages in thread
From: Bart De Schuymer @ 2014-01-17 20:30 UTC (permalink / raw)
  To: tingwei liu, netfilter-devel, netfilter, netdev

tingwei liu schreef op 17/01/2014 10:14:
> Dear all,
>
>         There is  a question has puzzled me for a long time.
>         You can find the topology from attachment.
>
>         Normal traffic is:
>
>                 PC(192.168.1.8)--->Bridge(eth0)--->Bridget(eth1)--->NAT
> server-->switch--->Server(192.168.5.3)
>
>         Now I want the ssh traffic like this:
>                PC(182.168.1.8)--->Bridge(eth0)--->eth2--->NAT
> server--->switch--->Server(192.168.5.3)
>
>
>        What I have done on LINUX Server:
>                #net.bridge.bridge-nf-call-iptables = 1
>                #iptables -t nat -A POSTROUTING -s 192.168.1.8 -p tcp
> --dport 22 -j SNAT --to-source 192.168.5.2
>
>        I have find the rule matched through command "iptables -t nat
> -nvL", but the packets doesn't sent to 192.168.5.3.
>        and "tcpdump -i eth2 tcp port 22" can not capture any packet!

You are trying to make a brouter. You don't need to set 
net.bridge.bridge-nf-call-iptables to 1, instead you need to add an 
ebtables rule in the BROUTING chain, see:
http://ebtables.sourceforge.net/examples/basic.html#ex_brouter

Something like this (in combination with your existing iptables rules):
ebtables -t broute -A BROUTING -p ipv4 --ip-source 192.168.1.8 \
--ip-protocol tcp --ip-destination-port 22 \
-j redirect --redirect-target DROP

cheers,
Bart


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fwd: Linux bridge for route
  2014-01-17 20:30   ` Bart De Schuymer
@ 2014-01-21  1:26     ` tingwei liu
  0 siblings, 0 replies; 3+ messages in thread
From: tingwei liu @ 2014-01-21  1:26 UTC (permalink / raw)
  To: Bart De Schuymer; +Cc: netfilter-devel, netfilter, netdev

On Sat, Jan 18, 2014 at 4:30 AM, Bart De Schuymer <bdschuym@pandora.be> wrote:
> tingwei liu schreef op 17/01/2014 10:14:
>
>> Dear all,
>>
>>         There is  a question has puzzled me for a long time.
>>         You can find the topology from attachment.
>>
>>         Normal traffic is:
>>
>>                 PC(192.168.1.8)--->Bridge(eth0)--->Bridget(eth1)--->NAT
>> server-->switch--->Server(192.168.5.3)
>>
>>         Now I want the ssh traffic like this:
>>                PC(182.168.1.8)--->Bridge(eth0)--->eth2--->NAT
>> server--->switch--->Server(192.168.5.3)
>>
>>
>>        What I have done on LINUX Server:
>>                #net.bridge.bridge-nf-call-iptables = 1
>>                #iptables -t nat -A POSTROUTING -s 192.168.1.8 -p tcp
>> --dport 22 -j SNAT --to-source 192.168.5.2
>>
>>        I have find the rule matched through command "iptables -t nat
>> -nvL", but the packets doesn't sent to 192.168.5.3.
>>        and "tcpdump -i eth2 tcp port 22" can not capture any packet!
>
>
> You are trying to make a brouter. You don't need to set
> net.bridge.bridge-nf-call-iptables to 1, instead you need to add an ebtables
> rule in the BROUTING chain, see:
> http://ebtables.sourceforge.net/examples/basic.html#ex_brouter
>
> Something like this (in combination with your existing iptables rules):
> ebtables -t broute -A BROUTING -p ipv4 --ip-source 192.168.1.8 \
> --ip-protocol tcp --ip-destination-port 22 \
> -j redirect --redirect-target DROP
>
Dear man,
      This is bad news. It does _not_ work!
      Is there any idea?
Thanks for your reply!

> cheers,
> Bart
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-21  1:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CA+qZnSRGKiFh8FiKMpVQku7CiWCMPq47FpPwrawvTC6KBPwz7A@mail.gmail.com>
2014-01-17  9:14 ` Fwd: Linux bridge for route tingwei liu
2014-01-17 20:30   ` Bart De Schuymer
2014-01-21  1:26     ` tingwei liu

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).