# where to store mtu setting for eth0?

## nickrout

For various esotric reasons I need to set mtu to 1470 for eth0, rather than the standard 1500. Where does gentoo store non-standard network settings so I don't have to add it to some startup script or do it manually each time??

Thanks

----------

## rac

Try adding "mtu 1470" to your iface_eth0=... line in /etc/conf.d/net.

----------

## mglauche

1470 is not as esoteric as one might think ... Its good to avoid ip fragmentation when you use tunnels.

Basicly if an IP packet enteres a tunnel, its wrapped inside another IP packet. But if that source packet is too big to fit into one packet it will be split off to 2 packets on the tunnel. So basicly you would have a 1470 byte (or simmilar) packet and a 30 byte packet going through the tunnel, and both get a 20-30 byte tcp/ip header ...

(ot: but fragementation is bad in general, thats why ipv6 doesn't have ANY fragmentation, they check the maximal MTU on the PATH, or they get an ICMP packet too lagre message, another reason not to turn ICMP off  :Twisted Evil:  )

----------

## nickrout

yes its  a tunnelling thing. pptp through a speedtouch home adsl modem. I just didn't think the reason was worth boring eveyone with  :Smile: 

Thanks

----------

## nickrout

rac:

I use dhcp and the line in /etc/conf.d/net is:

iface_eth0="dhcp"

I doesn't work if I add mtu 1470, whicjh I presume should be in the same set of quotes, ie:

iface_eth0="dhcp mtu 1470"

If I do that it bombs on starting or restarting eth0

Any ideas?

----------

## rac

 *nickrout wrote:*   

> rac:
> 
> I use dhcp

 

Oops.  I don't.  Rats.  Looking at /etc/init.d/net.eth0, I thought it would work smoothly for the static address case, but you're right - no way is it going to be that easy for dhcp.  Go back to just "iface_eth0="dhcp"".

 *Quote:*   

> Any ideas?

 

Yeah, but maybe crazy ones.  You can try this, but I haven't tested it at all, and I'm not very confident about it.  Look at /etc/init.d/net.eth0's start function.  At the end of the dhcp case after the closing brace, and before the fi, try adding 

```
/sbin/ifconfig ${IFACE} mtu ${MTU}
```

...and define MTU in /etc/conf.d/net.  If this works, we can think about ways to bulletproof it and maybe submit it as a feature enhancement request for inclusion in a future version of baselayout.

----------

## nickrout

Thanks, I'll try that tonight when I am back in front of that machine. All that stopping and starting eth0 last night seems to have killed sshd so I cannot login until I get home tonight.  :Sad: 

----------

## nickrout

rac, that worked. I don't know aboiut bulletproofing it, but it occurred to me that it might be more general if it was something like this:

in /etc/init.d/net.eth0:

/sbin/ifconfig ${IFACE}  ${DHCP_EXTRAS}

and in /etc/conf.d/net

DHCP_EXTRAS="mtu 1470 other_option whatever"

what do you think?

And thanks for the help (of course, but i'm sure many people forget to say it.)

<rant> By the way dhcp is documented as having an option to set the mtu from asetting on the server, however no implementaion of that seems to work, which is very annoying. If you have a router that acts as a dhcp server AND requires a certain mtu, it seems logical to allow it to set the mtu properly </rant>

----------

