This should work, or at least it does here. Please make sure to update the variables. The physical interface name, and also the logical WAN name.
For physical naming, ports from left to right are:
eth3, eth2, eth1, eth0, eth5, eth4
The logical name is simpler. If you’re using WAN or WAN1, it’s just wan, and WAN2 is wan2, you can check which one is configured as PPPoE from Settings>Networks>WANs, or by viewing the port overview in the Route10 config modal, and selecting the applicable WAN interface.
This script is recommended for single WAN environments only. If multi-WAN you may require to reboot or powercycle on reboots, upgrades, and/or provisions that touch the Route10. More on this below this comment. 3rd revision:
#!/bin/ash
# rfc4638 (baby jumbo) MTU/MRU fix for PPPoE on Route10
#
# Supports:
# A) PPPoE directly on PHY_IF (VID empty)
# B) PPPoE on VLAN device PHY_IF.VID (VID set)
#
# Behavior:
# - Always set PPP_SECTION MTU/MRU = PPP_MTU (default 1500)
# - If VID is set:
# * WAN_DEV = PHY_IF.VID
# * Set WAN_DEV MTU = CARRIER_MTU (default 1508)
# * Set PHY_IF MTU = CARRIER_MTU + VLAN_OVERHEAD (default 1512)
# - If VID is empty:
# * WAN_DEV = PHY_IF
# * Set PHY_IF MTU = CARRIER_MTU (default 1508)
# - Commit + apply at runtime + bounce PPP_SECTION
PPP_SECTION='wan2' # UCI interface section for PPPoE (e.g. 'wan' or 'wan2')
PHY_IF='eth4' # Parent physical device (e.g. eth4)
VID='' # Optional VLAN ID only (e.g. 35). Leave empty for no VLAN.
CARRIER_MTU='1508' # MTU required on the device carrying PPPoE frames (RFC4638)
PPP_MTU='1500' # MTU/MRU on PPPoE interface
VLAN_OVERHEAD='4' # 802.1Q tag overhead (bytes)
PATH=/sbin:/usr/sbin:/bin:/usr/bin
set -u
log() { logger -p user.notice -t post-cfg-rfc4638 "$*"; }
warn() { logger -p user.warning -t post-cfg-rfc4638 "$*"; }
# Find (or create) a "config device" section whose option name == $1, then set its mtu.
ensure_device_mtu() {
local dev="$1"
local mtu="$2"
local sec=""
# Look for: network.@device[N].name='<dev>'
sec="$(uci -q show network | sed -n "s/^\(network\.@device\[[0-9]\+\]\)\.name='${dev}'$/\1/p" | head -n1)"
if [ -z "${sec}" ]; then
# Create a new anonymous device section
sec="network.@device[-1]"
uci add network device >/dev/null 2>&1 || {
warn "Failed to add device section for ${dev}"
return 1
}
uci set "${sec}.name=${dev}" || return 1
fi
uci set "${sec}.mtu=${mtu}" || return 1
return 0
}
# Decide WAN device and MTUs
WAN_DEV="${PHY_IF}"
PARENT_MTU="${CARRIER_MTU}"
VID_DEV=""
if [ -n "${VID}" ]; then
VID_DEV="${PHY_IF}.${VID}"
WAN_DEV="${VID_DEV}"
PARENT_MTU="$(( CARRIER_MTU + VLAN_OVERHEAD ))"
fi
log "Applying RFC4638: PHY_IF=${PHY_IF} MTU=${PARENT_MTU}, WAN_DEV=${WAN_DEV} carrier MTU=${CARRIER_MTU}, ${PPP_SECTION} MTU/MRU=${PPP_MTU}"
# UCI: enforce device MTUs
ensure_device_mtu "${PHY_IF}" "${PARENT_MTU}" || warn "Failed to set UCI device MTU for ${PHY_IF}"
if [ -n "${VID_DEV}" ]; then
ensure_device_mtu "${VID_DEV}" "${CARRIER_MTU}" || warn "Failed to set UCI device MTU for ${VID_DEV}"
fi
# UCI: PPPoE interface settings
uci set "network.${PPP_SECTION}.device=${WAN_DEV}"
uci set "network.${PPP_SECTION}.mtu=${PPP_MTU}"
uci set "network.${PPP_SECTION}.mru=${PPP_MTU}"
uci commit network
# Apply at runtime (best effort)
ip link set dev "${PHY_IF}" mtu "${PARENT_MTU}" 2>/dev/null || warn "Runtime: failed to set ${PHY_IF} MTU ${PARENT_MTU}"
if [ -n "${VID_DEV}" ]; then
ip link set dev "${VID_DEV}" mtu "${CARRIER_MTU}" 2>/dev/null || warn "Runtime: failed to set ${VID_DEV} MTU ${CARRIER_MTU}"
fi
# Bounce PPPoE to re-negotiate
ifdown "${PPP_SECTION}" 2>/dev/null
ifup "${PPP_SECTION}" 2>/dev/null || warn "Failed to bring up ${PPP_SECTION}"
log "Bounced ${PPP_SECTION} (device=${WAN_DEV}); PHY_IF MTU ${PARENT_MTU}, carrier MTU ${CARRIER_MTU}"
exit 0
HERE’s a guide I wrote a while ago for generating/saving a post-cfg.sh file, if that’s helpful. If you have any questions or issues, please let me know.
EDIT: added note about single WAN recommendation for current iteration of baby jumbo script