Ticket #2552 (set MTU size in network scripts)

Jens Stroebel drifter at bcsoft.de
Thu Apr 23 08:36:52 PDT 2009


		Hi.

I wanted to write this for a while already, so here it goes:

Like thomas, we had to adjust the MTU for our interfaces;
we do it per default like this in the ipv4 service script:

===================== patch start ================================
--- lfs/sysconfig/network-devices/services/ipv4-static  2007-10-23
11:15:59.000000000 +0200
+++ lfs/sysconfig/network-devices/services/ipv4-static  2007-10-23
11:17:13.000000000 +0200
@@ -13,6 +13,9 @@
 #
 ########################################################################

+
+MTU=1492
+
 . /etc/sysconfig/rc
 . ${rc_functions}
 . ${IFCONFIG}
@@ -23,6 +26,7 @@
        exit 1
 fi

+
 if [ -z "${PREFIX}" -a -z "${PEER}" ]; then
        boot_mesg -n "PREFIX variable missing from ${IFCONFIG}," ${WARNING}
        boot_mesg " assuming 24."
@@ -48,6 +52,10 @@
                boot_mesg "Adding IPv4 address ${IP} to the ${1}
interface..."
                ip addr add ${args} dev ${1}
                evaluate_retval
+
+               echo "Setting the MTU for $1 to $MTU"
+               echo "$MTU" > "/sys/class/net/$1/mtu"
+               evaluate_retval

                if [ -n "${GATEWAY}" ]; then
                        if ip route | grep -q default; then
===================== patch end ================================

As the $IFCONFIG file is read after the fixed "MTU=1492, it can be
overridden inside of it.

But something like the attached patch "ipv4-static.diff" would probably
more desirable for the book, as it just modifies the current behavior in
case an MTU setting is present in the $IFCONFIG file.

There has been a script in the
bootscripts/contrib/sysconfig/network-devices/services/mtu file of the
LFS-Book repo, but I find it slightly more aesthetic to just include it
in the ipv4-static script, avoiding for example the "..cannot continue"
message which the seperate script would produce for $IFCONFIGs without
an MTU entry.

I've attached a patch to the (LFS-)book's sources to that effect.

While the the ticket resides in the trac for BLFS, the change would have
to take place in LFS, wouldn't it, so I cc'd the LFS development list.

		greets,
		  jens


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ipv4-static.diff
URL: <http://lists.linuxfromscratch.org/pipermail/blfs-dev/attachments/20090423/5145de7c/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: lfsbook-mtu_setting.diff
URL: <http://lists.linuxfromscratch.org/pipermail/blfs-dev/attachments/20090423/5145de7c/attachment-0001.ksh>


More information about the blfs-dev mailing list