From: Stephen Hemminger <shemminger@vyatta.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: linux bridge and MTU
Date: Wed, 29 Oct 2008 13:44:47 -0700 [thread overview]
Message-ID: <20081029134447.34c218c5@extreme> (raw)
In-Reply-To: <4908C83C.8040907@msgid.tls.msk.ru>
On Wed, 29 Oct 2008 23:31:56 +0300
Michael Tokarev <mjt@tls.msk.ru> wrote:
> Stephen Hemminger wrote:
> > On Wed, 29 Oct 2008 16:24:51 +0300
> > Michael Tokarev <mjt@tls.msk.ru> wrote:
> >
> >> There's an interesting interaction between different
> >> MTU (max transmission unit) values on interfaces
> >> which are bridged together. I'm trying to understand
> >> how it works.
> [exchanging larger packets between different interfaces
> on the same bridge]
>
> > The bridge is a pure level 2 switch. It tries to conform to the 802.1d standard
> > and therefore is agnostic of higher level protocols. To quote spec
>
> Yes it is. But in linux, bridge is not just that, it's ALSO
> a (virtual) network interface, with its own IP address(es),
> netmask(s) and so on. *And* with the MTU value.
> >
> > ---------------------
> >
> > 6.3.8 Maximum Service Data Unit Size
> > The Maximum Service Data Unit Size that can be supported by an IEEE 802 LAN varies with the MAC
> > method and its associated parameters (speed, electrical characteristics, etc.). It may be constrained by the
> > owner of the LAN. The Maximum Service Data Unit Size supported by a Bridge between two LANs is the
> > smaller of that supported by the LANs. No attempt is made by a Bridge to relay a frame to a LAN that does
> > not support the size of Service Data Unit conveyed by that frame.
>
> Yes that's what I observed, -- the MTU of the bridge *interface*
> is set to the minimum MTU of all interfaces "connected to" this
> bridge. That part works as expected.
>
> However, my question was somewhat different. The host "external"
> to a bridge is able to send larger packets (provided it's individual
> interface has sufficient MTU). But the host that provides home for
> that bridge can not, and can't even reply to larger packets. Or,
> rather, it does not TRYING to do so, so to say, knowing in advance
> that the MTU is smaller than that.
>
> What I'd expect from the bridge code is something like: to set
> MTU of the bridge device to the LARGEST mtu of all the interfaces,
> but tell the networking stack to fragment packet ONLY when such
> packet will go to the smaller-MTU interface. Since bridge in
> linux is NOT a pure level2 thing, it is much more smarter than
> that, and at least knows about MTU and routing.
The bridge device has no special back channel to the networking stack.
It can only advertise one MTU for the local interface.
> Ok, let's see how it works in case of one of the "external" hosts,
> connected to larger-MTU interface, sends a large packet to another
> host connected to the same bridge but on smaller-mtu port
> (hosts B and C in the above example):
>
> B <=== MTU=3000 ===> A (bridge) <=== MTU=1500 ====> C
>
> B sends a large packet to C. According to the MTU of its
> local network segment, it sends out a 3000-byte packet.
> And immediately receives an ICMP from A telling "fragmentation
> needed". So it corrects the MTU and goes on with smaller packets.
A never sees IP. It just drops packet.
> When B sends out a packet destined to A, or even to another
> host connected to the same bridge and also with larger MTU,
> the packet goes just fine.
>
> I.e., 2 hosts on a "larger-MTU-part" of the bridge can send
> and receive larger packets. This is true ONLY when the
> sending side is NOT the host running the bridge. When
> the sending host is A, it can't send larger packets. Which
> is somewhat strange, as it knows, unlike all the others,
> the whole thing, and has much more chances to "work right".
>
> > You might be able to do something with netfilter.
>
> The whole thing has nothing to do with netfilter. If I didn't
> misunderstand what you meant.
>
The reason I mentioned netfilter is it that it provides a way to
load special rules on a per interface/per-direction basis to alter
behaviour. It is the tool to put non-standard behaviour in.
One could argue that firewalling is really just one case of non-standard
behaviour.
next prev parent reply other threads:[~2008-10-29 20:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-29 13:24 linux bridge and MTU Michael Tokarev
2008-10-29 15:26 ` Stephen Hemminger
2008-10-29 20:31 ` Michael Tokarev
2008-10-29 20:44 ` Stephen Hemminger [this message]
2008-10-29 21:10 ` Michael Tokarev
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=20081029134447.34c218c5@extreme \
--to=shemminger@vyatta.com \
--cc=mjt@tls.msk.ru \
--cc=netdev@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 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.