Bug 9624 - Should be able to set MTU via ifcfg-ethX file
Summary: Should be able to set MTU via ifcfg-ethX file
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts   
(Show other bugs)
Version: 7.1
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2000-02-21 06:56 UTC by Dave O'Neill
Modified: 2014-03-17 02:12 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-06-06 00:32:33 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

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}`

-    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}
     # 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}

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...

> if [ -n "${MTU}" ]; then
>    ifconfig ${DEVICE} mtu ${MTU}
> fi

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

Note You need to log in before you can comment on or make changes to this bug.