How to Implement Linux Multi-Path TCP (MPTCP) for Seamless Mobile Handover

The foundational protocol of the internet, TCP (Transmission Control Protocol), was designed for static endpoints. A TCP connection is mathematically bound to a specific IP address on the client and a specific IP address on the server (a 4-tuple: Source IP, Source Port, Destination IP, Destination Port). If a user’s mobile device switches from Wi-Fi to a 5G cellular network, its IP address changes. The TCP connection immediately breaks, video streams buffer, and SSH sessions freeze.

Multi-Path TCP (MPTCP), standardized in RFC 8684, solves this fundamental flaw. MPTCP allows a single logical TCP connection to utilize multiple network paths (and multiple IP addresses) simultaneously. If the Wi-Fi connection drops, the data seamlessly continues over the 5G connection with absolutely zero packet loss or connection resets.

With MPTCP integrated directly into the upstream Linux kernel, systems administrators can deploy highly resilient edge servers and mobile VPN gateways that provide true, uninterrupted mobility.

Understanding MPTCP Architecture

MPTCP operates entirely within the Linux kernel TCP stack. To the user-space application (like a web browser or an SSH client), MPTCP is completely invisible. The application simply opens a standard socket.

Beneath the surface, MPTCP splits the logical connection into multiple subflows. Each subflow is a standard TCP connection utilizing a different network interface.

  1. Initialization: The client initiates a TCP handshake, but includes an MP_CAPABLE option in the SYN packet. If the Linux server also supports MPTCP, it replies with MP_CAPABLE, establishing the primary subflow.
  2. Path Discovery: The client informs the server that it has a second network interface (e.g., a cellular modem) using the ADD_ADDR option.
  3. Subflow Creation: The client initiates a secondary TCP handshake (using MP_JOIN) from its cellular IP address to the server.
  4. Multiplexing: The kernel’s MPTCP scheduler now dictates how data is sent. It can aggregate bandwidth by sending data simultaneously across both Wi-Fi and 5G, or it can hold the 5G path in standby, instantly failing over if the Wi-Fi path drops.

Step 1: Enabling MPTCP in the Linux Kernel

MPTCP support was merged into the mainline Linux kernel in version 5.6. However, for robust, production-ready features (like the in-kernel path manager), Kernel 5.15 or newer is highly recommended.

Verify that your kernel is compiled with MPTCP support:

zgrep CONFIG_MPTCP /proc/config.gz

You should see CONFIG_MPTCP=y.

Next, enable MPTCP globally on your Linux server via sysctl:

sudo sysctl -w net.mptcp.enabled=1

To make this persistent, add net.mptcp.enabled=1 to /etc/sysctl.d/99-mptcp.conf.

Step 2: Installing the MPTCP Daemon (mptcpd)

While the kernel handles the packet routing, you need a user-space daemon to manage the paths—specifically to detect when network interfaces go up or down and to negotiate the ADD_ADDR options with remote peers.

Install mptcpd (available in modern Ubuntu/Debian repositories):

sudo apt update
sudo apt install mptcpd

Enable and start the service:

sudo systemctl enable mptcpd
sudo systemctl start mptcpd

mptcpd will now automatically interact with the kernel’s Generic Netlink interface to manage subflows dynamically as the server’s routing table changes.

Step 3: Configuring the Path Manager via iproute2

The true power of MPTCP is controlled via the ip mptcp command (part of the standard iproute2 suite). You must instruct the Linux server which IP addresses it is allowed to use for secondary subflows.

Assume your server has two interfaces: eth0 (primary, 10.0.0.5) and eth1 (backup, 192.168.1.5).

To configure eth1 as a valid MPTCP endpoint and advertise it to clients:

sudo ip mptcp endpoint add 192.168.1.5 dev eth1 signal

If you want eth1 to only be used if eth0 goes down (a seamless failover scenario, conserving cellular data), you add the backup flag:

sudo ip mptcp endpoint add 192.168.1.5 dev eth1 signal backup

You can view the active endpoint configuration:

ip mptcp endpoint show

Step 4: Testing MPTCP Connectivity

For an MPTCP connection to utilize multiple paths, both the client and the server must support it. Apple iOS supports MPTCP natively (used heavily by Siri and Apple Music for seamless Wi-Fi to LTE handovers). On Linux, you must explicitly enable it.

To test the connection, you can use a specialized networking tool or simply force a standard socket to use MPTCP using the mptcpize utility.

On your Linux server, start a netcat listener wrapped in MPTCP:

mptcpize run nc -l -p 8080

On a Linux client (also with MPTCP enabled), connect to the server:

mptcpize run nc <server_ip> 8080

If you execute ss -tni on the server, you will see the active connection. Look for the mptcp keyword in the socket statistics output, confirming that the kernel is managing the subflows.

Conclusion

Multi-Path TCP breaks the thirty-year-old constraint of IP-bound TCP connections. By enabling MPTCP in the Linux kernel and configuring the path manager, systems administrators can deploy network infrastructure that provides absolute persistence, allowing mobile clients to seamlessly transition between Wi-Fi and 5G networks without dropping a single byte of active data.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.