For users connecting via PPPoE (Point-to-Point Protocol over Ethernet), ensuring the correct MTU (Maximum Transmission Unit) setting on their router is crucial for maintaining optimal network performance and internet access.

Understanding MTU

MTU, which stands for Maximum Transmission Unit, is a concept related to Layer 2 networking. Its purpose is to limit the size of data (payload) within a MAC frame.

Think of data packets like goods being transported by trucks. If the goods are too large, the truck cannot transport them efficiently. Conversely, if the packaging is too light or insufficient, transportation efficiency suffers. MTU is akin to the maximum load capacity of the truck.

In essence, data packets equal to or smaller than the MTU are transmitted normally, while those larger than the MTU are split into smaller packets. Understanding this concept allows us to incrementally adjust packet size until splitting is necessary, thus determining the optimal MTU value.

Determining the Optimal PPPoE MTU

The IEEE 802.3 standard sets the MTU for Ethernet at 1500 bytes. However, PPPoE adds an 8-byte header, resulting in a maximum PPPoE MTU of 1492 bytes. Although 1429 is a common PPPoE MTU, actual values may vary slightly among different ISPs. To ascertain the correct value, we can utilize the ping command.

When using the ping command, which operates at Layer 4 using the ICMP protocol, the structure is ICMP → IP → Ethernet (PPPoE).

The equation ICMP packet size + ICMP header (8 bytes) + IP header (20 bytes)PPPoE MTU.

This simplifies to: ICMP packet (max size) + 28 = PPPoE MTU.

Given the maximum PPPoE MTU of 1492, subtracting 28 yields a maximum ICMP packet size of 1464 bytes. By adjusting this value, we can quickly determine the optimal MTU.

Using the ping Command

To determine the optimal ICMP packet size:

# macOS
# -D for "Don't Fragment"; -s for packetsize。
ping -D -s 1464 223.5.5.5

# Linux
# -4 for IPv4; `-M do` for "Don't Fragment",is not supported by OpenWRT, remove it; -s for packetsize。
ping -4 -M do -s 1464 223.5.5.5

# Windows
# -f for "Don't Fragment"; -l for packetsize/data length。
ping -f -l 1464 223.5.5.5

After obtaining the ICMP packet size, add 28 to determine the optimal PPPoE MTU. For example, if the maximum pinged packet size is 1460, the PPPoE MTU should be set to 1488 (1460 + 28).

Changing the Computer’s MTU

While typically only the router’s MTU needs adjustment, for direct dial-up from a computer, the computer’s MTU may require modification. Below are instructions for macOS, Linux, and Windows.

macOS MTU Adjustment

# Get Interface Name
ifconfig
# Determine Optimal PPPoE MTU
ping -D -s 1464 223.5.5.5
# Use `networksetup` to Check and Modify MTU
networksetup -getMTU {iface} 
networksetup -setMTU {iface} {mtu}

Linux MTU Adjustment

# Get Interface Name and MTU (using ifconfig or ip)
ifconfig -a | grep mtu
ip addr | grep mtu
# Determine Optimal PPPoE MTU
ping -s 1464 223.5.5.5
# Set MTU by adding `mtu {mtu}` to the interfaces file
vim /etc/network/interfaces
# Restart Network
/etc/init.d/networking restart

Windows MTU Adjustment

# Get Interface Name
netsh interface ipv4 show interfaces
# Determine Optimal PPPoE MTU
ping -l 1464 223.5.5.5
# Set MTU
netsh interface ipv4 set subinterface {id} mtu={mtu} store=persistent

Tips

  • Replace the IP address used for ping with your preferred DNS server or website domain.
  • If the computer does not directly dial up, the default MTU is 1500 and typically does not require adjustment.