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


--- lfs/sysconfig/network-devices/services/ipv4-static.orig     2009-04-23 
17:10:26.000000000 +0200
+++ lfs/sysconfig/network-devices/services/ipv4-static  2009-04-23 
17:13:20.000000000 +0200
@@ -49,6 +49,12 @@
                ip addr add ${args} dev ${1}
                evaluate_retval
        
+               if [ -n "${MTU}" ]; then
+               boot_mesg "Setting the MTU for $1 to $MTU"
+               echo "$MTU" > "/sys/class/net/$1/mtu"
+               evaluate_retval
+               fi
+
                if [ -n "${GATEWAY}" ]; then
                        if ip route | grep -q default; then
                                boot_mesg "Gateway already setup; skipping." 
${WARNING}



Index: bootscripts/contrib/lsb-v3/sysconfig/network-devices/services/ipv4-static
===================================================================
--- bootscripts/contrib/lsb-v3/sysconfig/network-devices/services/ipv4-static   
(revision 8852)
+++ bootscripts/contrib/lsb-v3/sysconfig/network-devices/services/ipv4-static   
(working copy)
@@ -48,6 +48,12 @@
                ip addr add ${args} dev ${1}
                evaluate_retval
        
+               if [ -n "${MTU}" ]; then
+               boot_mesg "Setting the MTU for $1 to $MTU"
+               echo "$MTU" > "/sys/class/net/$1/mtu"
+               evaluate_retval
+               fi
+
                if [ -n "${GATEWAY}" ]; then
                        if ip route | grep -q default; then
                                log_warning_msg "Gateway already setup; 
skipping." ${WARNING}
Index: bootscripts/lfs/sysconfig/network-devices/services/ipv4-static
===================================================================
--- bootscripts/lfs/sysconfig/network-devices/services/ipv4-static      
(revision 8852)
+++ bootscripts/lfs/sysconfig/network-devices/services/ipv4-static      
(working copy)
@@ -49,6 +49,12 @@
                ip addr add ${args} dev ${1}
                evaluate_retval
        
+               if [ -n "${MTU}" ]; then
+               boot_mesg "Setting the MTU for $1 to $MTU"
+               echo "$MTU" > "/sys/class/net/$1/mtu"
+               evaluate_retval
+               fi
+
                if [ -n "${GATEWAY}" ]; then
                        if ip route | grep -q default; then
                                boot_mesg "Gateway already setup; skipping." 
${WARNING}


-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to