Bug 9624

Summary: Should be able to set MTU via ifcfg-ethX file
Product: [Retired] Red Hat Linux Reporter: Dave O'Neill <dave>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 7.1CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-06-06 00:32:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dave O'Neill 2000-02-21 06:56:19 UTC
It would be nice to be able to set the MTU for an interface via the
appropriate ifup-XXXX file in /etc/sysconfig/network-scripts.   The patch
below allows setting of the MTU with 'MTU=nnnn' in said file.


--- ifup.old    Sun Apr 18 19:36:47 1999
+++ ifup        Fri Oct 15 20:11:03 1999
@@ -102,7 +102,13 @@
        eval `/bin/ipcalc --network ${IPADDR} ${NETMASK}`
     fi

-    ifconfig ${DEVICE} ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
+    if [ "foo$MTU" != "foo" ]; then
+               SETMTU="mtu $MTU"
+       else
+               SETMTU=""
+    fi
+
+    ifconfig ${DEVICE} ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
${SETMTU}
     # don't re-add subnet route on 2.2 kernels, but add a route
     # to a non-local subnet.
     # stupid hack, but it should work

Comment 1 Bill Nottingham 2000-03-20 16:20:59 UTC
Added as of initscripts-5.02-1.

Comment 2 Thornton Prime 2001-05-29 19:37:16 UTC
Has this bug resurfaced in 7.1?

The new ifup script has:


153:ifconfig ${DEVICE} ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST} \
$(toggle_value arp $ARP) \
$(toggle_value promisc $PROMISC) \
$(toggle_value allmulti $ALLMULTI)

It only reads and sets MTU if interface does not specify IP:

135:if [ -z "${IPADDR}" ]; then
# enable device without IP, useful for e.g. PPPoE
ifconfig ${DEVICE} up ${MTU:+mtu $MTU}
exec /etc/sysconfig/network-scripts/ifup-post ${CONFIG} ${2}
fi



Comment 3 Thornton Prime 2001-05-29 19:41:29 UTC
I verified that this was fine in 7.0.

Comment 4 Mike Gahagan 2001-06-06 00:14:40 UTC
Yes this bug does exist in 7.1, to reproduce, simply add an MTU=xxx line in /etc/sysconfig/network-scripts/ifcfg-ethx then restart the network, you will see that after running ifconfig that the MTU is still set to the old value where 'ifconfig ethx mtu 1300' on the command line will change the MTU on the running interface


Comment 5 Mike Gahagan 2001-06-06 00:32:29 UTC
well this little patch seems to fix it...

91a92,95
> if [ -n "${MTU}" ]; then
>    ifconfig ${DEVICE} mtu ${MTU}
> fi
> 
152c156
<     
---
> 



Comment 6 Bill Nottingham 2001-06-22 15:20:05 UTC
Fixed in CVS, will be in 5.93-1 or later.