All of lore.kernel.org
 help / color / mirror / Atom feed
* Ebtables usage
@ 2011-02-15  9:04 Jacky Lam
  2011-02-15  9:48 ` Pandu Poluan
  0 siblings, 1 reply; 8+ messages in thread
From: Jacky Lam @ 2011-02-15  9:04 UTC (permalink / raw)
  To: netfilter

Hi,

     I am a dummy about network administration. But I currently setup
my Linux box as a switch to forward the packet from eth0 to eth1. But
I find the throughput is not good. It seems the overhead of IP stack
is too high. I want to know if ebtables can allow me to do the job
below IP level? If yes, can anyone show me how to setup up that?
Thanks very much.

Jacky

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

* Re: Ebtables usage
  2011-02-15  9:04 Ebtables usage Jacky Lam
@ 2011-02-15  9:48 ` Pandu Poluan
  2011-02-15 10:06   ` Jacky Lam
  0 siblings, 1 reply; 8+ messages in thread
From: Pandu Poluan @ 2011-02-15  9:48 UTC (permalink / raw)
  To: Jacky Lam, netfilter

Have you set up Linux bridging?

Here's a reasonably complete guide:

http://tldp.org/HOWTO/Ethernet-Bridge-netfilter-HOWTO.html

Rgds,


On 2011-02-15, Jacky Lam <lamshuyin@gmail.com> wrote:
> Hi,
>
>      I am a dummy about network administration. But I currently setup
> my Linux box as a switch to forward the packet from eth0 to eth1. But
> I find the throughput is not good. It seems the overhead of IP stack
> is too high. I want to know if ebtables can allow me to do the job
> below IP level? If yes, can anyone show me how to setup up that?
> Thanks very much.
>
> Jacky
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


-- 
--
Pandu E Poluan - IT Optimizer
My website: http://pandu.poluan.info/

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

* Re: Ebtables usage
  2011-02-15  9:48 ` Pandu Poluan
@ 2011-02-15 10:06   ` Jacky Lam
  2011-02-15 10:47     ` Pascal Hambourg
  0 siblings, 1 reply; 8+ messages in thread
From: Jacky Lam @ 2011-02-15 10:06 UTC (permalink / raw)
  To: Pandu Poluan; +Cc: netfilter

Yes, my config is like this:

    Computer A (10.1.4.1) <-----> (eth0: 10.1.4.5) Linux Switch (eth1:
11.1.4.5) <-------> Computer B (11.1.4.3)

I each ip_forwarding and config the route table of Computer A,B. I get
500Mb/s from iperf while Linux Switch is 100% loaded.
As I know this switching is done in IP level, I want to do the job in
data link layer to get higher throughput/lower CPU usage.

Then I tried the following configuration:

    Computer A (10.1.4.1) <-----> (eth0) Linux Switch (eth1) <------->
Computer B (10.1.4.3)

I tried to setup a bridge like this as some document said:

iptables -t nat -A POSTROUTING -s 10.1.4.0/24 -d 10.1.4.0/24 -j ACCEPT
iptables -t nat -A POSTROUTING -s 10.1.4.0/24 -j MASQUERADE

brctl addbr br0
brctl stp br0 off
brctl addif br0 eth0
brctl addif br0 eth1

ifconfig eth0 0 0.0.0.0
ifconfig eth1 0 0.0.0.0
ifconfig br0 10.1.4.5 netmask 255.255.255.0 up

echo '1' > /proc/sys/net/ipv4/ip_forward

But the throughput is only 200Mb/s and my Linux Switch is 100% loaded.
What's wrong with that?


Jacky

On Tue, Feb 15, 2011 at 5:48 PM, Pandu Poluan <pandu@poluan.info> wrote:
> Have you set up Linux bridging?
>
> Here's a reasonably complete guide:
>
> http://tldp.org/HOWTO/Ethernet-Bridge-netfilter-HOWTO.html
>
> Rgds,
>
>
> On 2011-02-15, Jacky Lam <lamshuyin@gmail.com> wrote:
>> Hi,
>>
>>      I am a dummy about network administration. But I currently setup
>> my Linux box as a switch to forward the packet from eth0 to eth1. But
>> I find the throughput is not good. It seems the overhead of IP stack
>> is too high. I want to know if ebtables can allow me to do the job
>> below IP level? If yes, can anyone show me how to setup up that?
>> Thanks very much.
>>
>> Jacky
>> --
>> To unsubscribe from this list: send the line "unsubscribe netfilter" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
>
> --
> --
> Pandu E Poluan - IT Optimizer
> My website: http://pandu.poluan.info/
>

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

* Re: Ebtables usage
  2011-02-15 10:06   ` Jacky Lam
@ 2011-02-15 10:47     ` Pascal Hambourg
  2011-02-15 22:53       ` Jacky Lam
  0 siblings, 1 reply; 8+ messages in thread
From: Pascal Hambourg @ 2011-02-15 10:47 UTC (permalink / raw)
  To: Jacky Lam; +Cc: netfilter

Hello,

Jacky Lam a écrit :
> Yes, my config is like this:
> 
>     Computer A (10.1.4.1) <-----> (eth0: 10.1.4.5) Linux Switch (eth1:
> 11.1.4.5) <-------> Computer B (11.1.4.3)
> 
> I each ip_forwarding and config the route table of Computer A,B. I get
> 500Mb/s from iperf while Linux Switch is 100% loaded.
> As I know this switching is done in IP level,

Your box is set up as a router, not a switch/bridge. Routing is done at
the IP level, and switching/bridging is done at the ethernet level.

> I want to do the job in
> data link layer to get higher throughput/lower CPU usage.

Not sure you'll get higher throughput though. Bridging adds its own
overhead.

> Then I tried the following configuration:
> 
>     Computer A (10.1.4.1) <-----> (eth0) Linux Switch (eth1) <------->
> Computer B (10.1.4.3)
> 
> I tried to setup a bridge like this as some document said:
> 
> iptables -t nat -A POSTROUTING -s 10.1.4.0/24 -d 10.1.4.0/24 -j ACCEPT
> iptables -t nat -A POSTROUTING -s 10.1.4.0/24 -j MASQUERADE

What do you need these rules for ? They are not needed for pure bridging.

> brctl addbr br0
> brctl stp br0 off
> brctl addif br0 eth0
> brctl addif br0 eth1
> 
> ifconfig eth0 0 0.0.0.0
> ifconfig eth1 0 0.0.0.0

Ok.

> ifconfig br0 10.1.4.5 netmask 255.255.255.0 up
> 
> echo '1' > /proc/sys/net/ipv4/ip_forward

This is IP-related and not required for pure bridging.

> But the throughput is only 200Mb/s and my Linux Switch is 100% loaded.
> What's wrong with that?

It may be the overhead caused by bridge-nf, netfilter, IPv4 conntrack
and iptables.
Try with /proc/sys/net/bridge/bridge-nf-call-iptables set to 0.

You did not explain what you want to do exactly with this box.

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

* Re: Ebtables usage
  2011-02-15 10:47     ` Pascal Hambourg
@ 2011-02-15 22:53       ` Jacky Lam
  2011-02-16  8:50         ` Pascal Hambourg
  0 siblings, 1 reply; 8+ messages in thread
From: Jacky Lam @ 2011-02-15 22:53 UTC (permalink / raw)
  To: Pascal Hambourg; +Cc: netfilter

I want to share a network service by two computers but I don't have
any extra router or switch, but one computer has 2 ethernet cards and
running Linux. But that computer is old and slow. So I want to know if
I can set up that computer as a ethernet level switch/bridge.

That means I am done right (except the two rules at the beginning) to
setup a ethernet switch? I don't need to setup any rules by iptables
or ebtables?

Thanks for helping.

On Tue, Feb 15, 2011 at 6:47 PM, Pascal Hambourg
<pascal.mail@plouf.fr.eu.org> wrote:
> Hello,
>
> Jacky Lam a écrit :
>> Yes, my config is like this:
>>
>>     Computer A (10.1.4.1) <-----> (eth0: 10.1.4.5) Linux Switch (eth1:
>> 11.1.4.5) <-------> Computer B (11.1.4.3)
>>
>> I each ip_forwarding and config the route table of Computer A,B. I get
>> 500Mb/s from iperf while Linux Switch is 100% loaded.
>> As I know this switching is done in IP level,
>
> Your box is set up as a router, not a switch/bridge. Routing is done at
> the IP level, and switching/bridging is done at the ethernet level.
>
>> I want to do the job in
>> data link layer to get higher throughput/lower CPU usage.
>
> Not sure you'll get higher throughput though. Bridging adds its own
> overhead.
>
>> Then I tried the following configuration:
>>
>>     Computer A (10.1.4.1) <-----> (eth0) Linux Switch (eth1) <------->
>> Computer B (10.1.4.3)
>>
>> I tried to setup a bridge like this as some document said:
>>
>> iptables -t nat -A POSTROUTING -s 10.1.4.0/24 -d 10.1.4.0/24 -j ACCEPT
>> iptables -t nat -A POSTROUTING -s 10.1.4.0/24 -j MASQUERADE
>
> What do you need these rules for ? They are not needed for pure bridging.
>
>> brctl addbr br0
>> brctl stp br0 off
>> brctl addif br0 eth0
>> brctl addif br0 eth1
>>
>> ifconfig eth0 0 0.0.0.0
>> ifconfig eth1 0 0.0.0.0
>
> Ok.
>
>> ifconfig br0 10.1.4.5 netmask 255.255.255.0 up
>>
>> echo '1' > /proc/sys/net/ipv4/ip_forward
>
> This is IP-related and not required for pure bridging.
>
>> But the throughput is only 200Mb/s and my Linux Switch is 100% loaded.
>> What's wrong with that?
>
> It may be the overhead caused by bridge-nf, netfilter, IPv4 conntrack
> and iptables.
> Try with /proc/sys/net/bridge/bridge-nf-call-iptables set to 0.
>
> You did not explain what you want to do exactly with this box.
>

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

* Re: Ebtables usage
  2011-02-15 22:53       ` Jacky Lam
@ 2011-02-16  8:50         ` Pascal Hambourg
  2011-02-16  9:32           ` Jacky Lam
  0 siblings, 1 reply; 8+ messages in thread
From: Pascal Hambourg @ 2011-02-16  8:50 UTC (permalink / raw)
  To: Jacky Lam; +Cc: netfilter

Jacky Lam a écrit :
> I want to share a network service by two computers but I don't have
> any extra router or switch, but one computer has 2 ethernet cards and
> running Linux. But that computer is old and slow. So I want to know if
> I can set up that computer as a ethernet level switch/bridge.

What kind of network service ? Is that service running on the old computer ?
You can set up a computer as an ethernet bridge, but that old computer
may not be fast enough to handle gigabit traffic.

> That means I am done right (except the two rules at the beginning) to
> setup a ethernet switch? I don't need to setup any rules by iptables
> or ebtables?

You need iptables and ebtables rules for IP and ethernet packet
filtering and mangling. You don't need them if the box does only plain
routing or bridging.

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

* Re: Ebtables usage
  2011-02-16  8:50         ` Pascal Hambourg
@ 2011-02-16  9:32           ` Jacky Lam
  2011-02-17 11:28             ` Pascal Hambourg
  0 siblings, 1 reply; 8+ messages in thread
From: Jacky Lam @ 2011-02-16  9:32 UTC (permalink / raw)
  To: Pascal Hambourg; +Cc: netfilter

On 2/16/2011 4:50 PM, Pascal Hambourg wrote:
> Jacky Lam a écrit :
>> I want to share a network service by two computers but I don't have
>> any extra router or switch, but one computer has 2 ethernet cards and
>> running Linux. But that computer is old and slow. So I want to know if
>> I can set up that computer as a ethernet level switch/bridge.
> What kind of network service ? Is that service running on the old computer ?
> You can set up a computer as an ethernet bridge, but that old computer
> may not be fast enough to handle gigabit traffic.
>
I mean the internet service. Yes, the old computer is very slow. That's 
why I want to lower the overhead while being a switch.
>> That means I am done right (except the two rules at the beginning) to
>> setup a ethernet switch? I don't need to setup any rules by iptables
>> or ebtables?
> You need iptables and ebtables rules for IP and ethernet packet
> filtering and mangling. You don't need them if the box does only plain
> routing or bridging.
>
Thanks.

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

* Re: Ebtables usage
  2011-02-16  9:32           ` Jacky Lam
@ 2011-02-17 11:28             ` Pascal Hambourg
  0 siblings, 0 replies; 8+ messages in thread
From: Pascal Hambourg @ 2011-02-17 11:28 UTC (permalink / raw)
  To: Jacky Lam; +Cc: netfilter

Jacky Lam a écrit :
>>
> I mean the internet service. Yes, the old computer is very slow. That's 
> why I want to lower the overhead while being a switch.

I understand, but the actual system load may be much lower, depending on
the bandwidth of the internet access. I would be surprised if you had
gigabit-grade internet access but could not afford a dumb ethernet switch.

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

end of thread, other threads:[~2011-02-17 11:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-15  9:04 Ebtables usage Jacky Lam
2011-02-15  9:48 ` Pandu Poluan
2011-02-15 10:06   ` Jacky Lam
2011-02-15 10:47     ` Pascal Hambourg
2011-02-15 22:53       ` Jacky Lam
2011-02-16  8:50         ` Pascal Hambourg
2011-02-16  9:32           ` Jacky Lam
2011-02-17 11:28             ` Pascal Hambourg

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.