different MTU on different VLAN's

I want my regular eth0 interface to have an MTU of 1500, and have eth0.12 with an MTU of 9000, but Linux seems to want to keep the MTU consistent across all VLAN interfaces. Has anyone done this before? I don't know if it's a limitation of my Ethernet hardware or of Linux. In theory, as long as Linux only transmits <=1500 byte packets it shouldn't matter what the underlying hardware is set to, so I don't know why this restriction exists. Thanks James

James Harper wrote:
I want my regular eth0 interface to have an MTU of 1500, and have eth0.12 with an MTU of 9000, but Linux seems to want to keep the MTU consistent across all VLAN interfaces.
Are you using "ip link", or what?
Has anyone done this before?
I haven't.

James Harper wrote:
I want my regular eth0 interface to have an MTU of 1500, and have eth0.12 with an MTU of 9000, but Linux seems to want to keep the MTU consistent across all VLAN interfaces.
Are you using "ip link", or what?
Yes. ip link set dev eth0.12 mtu 9000 It seems that openvswitch might allow me to do it (it handles vlans etc) but that's more overhead than I care for for a san server. James

On 01/10/2012, at 8:12, James Harper <james.harper@bendigoit.com.au> wrote:
I want my regular eth0 interface to have an MTU of 1500, and have eth0.12 with an MTU of 9000, but Linux seems to want to keep the MTU consistent across all VLAN interfaces.
Has anyone done this before? I don't know if it's a limitation of my Ethernet hardware or of Linux. In theory, as long as Linux only transmits <=1500 byte packets it shouldn't matter what the underlying hardware is set to, so I don't know why this restriction exists.
The base interface needs to have an MTU at least that of any vlan interface, but you should be able to set each vlan interface MTU to any value. However each vlan interface MTU will need to be set explicitly, else it will inherit the MTU on creation. What distro are you using? On Debian my interfaces file is similar to: iface eth0 inet manual up ip link set $DEV up mtu 1540 iface eth0.10 inet static ... mtu 1500

On 01/10/2012, at 8:12, James Harper <james.harper@bendigoit.com.au> wrote:
I want my regular eth0 interface to have an MTU of 1500, and have eth0.12 with an MTU of 9000, but Linux seems to want to keep the MTU consistent across all VLAN interfaces.
Has anyone done this before? I don't know if it's a limitation of my Ethernet hardware or of Linux. In theory, as long as Linux only transmits <=1500 byte packets it shouldn't matter what the underlying hardware is set to, so I don't know why this restriction exists.
The base interface needs to have an MTU at least that of any vlan interface, but you should be able to set each vlan interface MTU to any value.
However each vlan interface MTU will need to be set explicitly, else it will inherit the MTU on creation.
What distro are you using? On Debian my interfaces file is similar to:
iface eth0 inet manual up ip link set $DEV up mtu 1540
iface eth0.10 inet static ... mtu 1500
I need it the other way around - eth0=1500, eth0.12=9000. I can't think of a reason why the hardware MTU couldn't be set to 9000 on the physical interface, but that Linux just doesn't send packets larger than 1500 on eth0. I guess I'll need to play with the switch to put vlan1 on another tagged vlan. Thanks James

On Mon, Oct 01, 2012 at 02:40:47AM +0000, James Harper wrote:
I need it the other way around - eth0=1500, eth0.12=9000. I can't
you can't. the MTU of a vlan interface can't be any larger than the MTU of the underlying interface. a plumbing-based analogy is more suited to this situation than the more usual car-based analogy, so here goes: "you can not fit a larger pipe inside a smaller pipe" so, set the eth0 to 9000, eth0.12 to 9000, and make a new vlan interface for everything else with an mtu of 1500.
think of a reason why the hardware MTU couldn't be set to 9000 on the physical interface, but that Linux just doesn't send packets larger than 1500 on eth0.
what? that makes no sense. The MTU setting on an interface is what tells linux how large the packets can be before they have to be fragmented. if you set the MTU to 9000, then you're telling Linux that packets up to that size are OK. it won't magically deduce that you really meant 1500 most of the time but sometimes 9000. craig -- craig sanders <cas@taz.net.au>

think of a reason why the hardware MTU couldn't be set to 9000 on the physical interface, but that Linux just doesn't send packets larger than 1500 on eth0.
what? that makes no sense.
The MTU setting on an interface is what tells linux how large the packets can be before they have to be fragmented.
if you set the MTU to 9000, then you're telling Linux that packets up to that size are OK. it won't magically deduce that you really meant 1500 most of the time but sometimes 9000.
It makes perfect sense. Think of the physical interface as being separate from the eth0 interface, so eth0 is just another vlan: Physical interface MTU = 9000 (>= largest VLAN MTU) eth0 (vlan1, untagged) MTU = 1500 eth0.12 (vlan12, tagged) MTU = 9000 James

On 01/10/2012, at 13:22, James Harper <james.harper@bendigoit.com.au> wrote:
It makes perfect sense. Think of the physical interface as being separate from the eth0 interface, so eth0 is just another vlan:
Physical interface MTU = 9000 (>= largest VLAN MTU) eth0 (vlan1, untagged) MTU = 1500 eth0.12 (vlan12, tagged) MTU = 9000
you could create a eth0.1 vlan iface with 1500 MTU and hope the switch treats it the same as untagged frames. most switches should do this, though I've never tested it

On Mon, 1 Oct 2012, James Harper <james.harper@bendigoit.com.au> wrote:
if you set the MTU to 9000, then you're telling Linux that packets up to that size are OK. it won't magically deduce that you really meant 1500 most of the time but sometimes 9000.
It makes perfect sense. Think of the physical interface as being separate from the eth0 interface, so eth0 is just another vlan:
Physical interface MTU = 9000 (>= largest VLAN MTU) eth0 (vlan1, untagged) MTU = 1500 eth0.12 (vlan12, tagged) MTU = 9000
Why does it have to be eth0 with an mtu of 1500? Why not call that eth0.1 and have the base eth0 not used for anything? -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/

On Mon, 1 Oct 2012, James Harper <james.harper@bendigoit.com.au> wrote:
if you set the MTU to 9000, then you're telling Linux that packets up to that size are OK. it won't magically deduce that you really meant 1500 most of the time but sometimes 9000.
It makes perfect sense. Think of the physical interface as being separate from the eth0 interface, so eth0 is just another vlan:
Physical interface MTU = 9000 (>= largest VLAN MTU) eth0 (vlan1, untagged) MTU = 1500 eth0.12 (vlan12, tagged) MTU = 9000
Why does it have to be eth0 with an mtu of 1500? Why not call that eth0.1 and have the base eth0 not used for anything?
I've wondered that. Is eth0.1 (or can eth0.1 be) configured as an untagged interface and can see untagged packets? Thanks James

James Harper <james.harper@bendigoit.com.au> wrote:
I've wondered that. Is eth0.1 (or can eth0.1 be) configured as an untagged interface and can see untagged packets?
This looks helpful: http://www.linuxsa.org.au/pipermail/linuxsa/2006-July/084589.html

On 01/10/2012, at 12:40, James Harper <james.harper@bendigoit.com.au> wrote:
I need it the other way around - eth0=1500, eth0.12=9000. I can't think of a reason why the hardware MTU couldn't be set to 9000 on the physical interface, but that Linux just doesn't send packets larger than 1500 on eth0.
that's the thing. eth0 is the physical interface, so it needs at least the MTU of any logical interface, plus vlan headers. when using vlans in Linux, I try to keep the physical interface free of IP and use it only as a vlan trunk. But I understand this isn't possible in all situations where you need tagged+untagged frames.

On 01/10/2012, at 20:27, "Trent W. Buck" <trentbuck@gmail.com> wrote:
hannah commodore wrote:
iface eth0 inet manual up ip link set $DEV up mtu 1540
What's the use case for 1540?
we have multiple vlans delivered by one of our providers. one for Internet IP traffic and two more carrying l2tp being terminated on our routers. 1540 was the safe amount accounting for all possible overhead
participants (6)
-
Craig Sanders
-
hannah commodore
-
James Harper
-
Jason White
-
Russell Coker
-
Trent W. Buck