Este contenido no está disponible en el idioma seleccionado.
Chapter 36. Getting started with Multipath TCP
Multipath TCP (MPTCP) is an extension to the original TCP protocol (single-path). MPTCP enables a transport connection to operate across multiple paths simultaneously, and brings network connection redundancy to user endpoint devices.
36.1. Understanding MPTCP Copiar enlaceEnlace copiado en el portapapeles!
The Multipath TCP (MPTCP) protocol provides simultaneous usage of multiple paths between connection endpoints. The protocol design improves connection stability and also brings other benefits compared to the single-path TCP.
In MPTCP terminology, links are considered as paths.
The following are some of the advantages of using MPTCP:
- It allows a connection to simultaneously use multiple network interfaces.
- In case a connection is bound to a link speed, the usage of multiple links can increase the connection throughput. Note, that in case of the connection is bound to a CPU, the usage of multiple links causes the connection slowdown.
- It increases the resilience to link failures.
36.2. Preparing RHEL to enable MPTCP support Copiar enlaceEnlace copiado en el portapapeles!
By default the MPTCP support is disabled in RHEL. Enable MPTCP so that applications that support this feature can use it. Additionally, you have to configure user space applications to force use MPTCP sockets if those applications have TCP sockets by default.
Prerequisites
The following packages are installed:
-
iperf3 -
mptcpd -
systemtap
Procedure
Enable MPTCP sockets in the kernel:
echo "net.mptcp.enabled=1" > /etc/sysctl.d/90-enable-MPTCP.conf sysctl -p /etc/sysctl.d/90-enable-MPTCP.conf
# echo "net.mptcp.enabled=1" > /etc/sysctl.d/90-enable-MPTCP.conf # sysctl -p /etc/sysctl.d/90-enable-MPTCP.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow Start the
iperf3server, and force it to create MPTCP sockets instead of TCP sockets:mptcpize run iperf3 -s
# mptcpize run iperf3 -s Server listening on 5201Copy to Clipboard Copied! Toggle word wrap Toggle overflow Connect the client to the server, and force it to create MPTCP sockets instead of TCP sockets:
mptcpize iperf3 -c 127.0.0.1 -t 3
# mptcpize iperf3 -c 127.0.0.1 -t 3Copy to Clipboard Copied! Toggle word wrap Toggle overflow After the connection is established, verify the
ssoutput to see the subflow-specific status:ss -nti '( dport :5201 )'
# ss -nti '( dport :5201 )' State Recv-Q Send-Q Local Address:Port Peer Address:Port Process ESTAB 0 0 127.0.0.1:41842 127.0.0.1:5201 cubic wscale:7,7 rto:205 rtt:4.455/8.878 ato:40 mss:21888 pmtu:65535 rcvmss:536 advmss:65483 cwnd:10 bytes_sent:141 bytes_acked:142 bytes_received:4 segs_out:8 segs_in:7 data_segs_out:3 data_segs_in:3 send 393050505bps lastsnd:2813 lastrcv:2772 lastack:2772 pacing_rate 785946640bps delivery_rate 10944000000bps delivered:4 busy:41ms rcv_space:43690 rcv_ssthresh:43690 minrtt:0.008 tcp-ulp-mptcp flags:Mmec token:0000(id:0)/2ff053ec(id:0) seq:3e2cbea12d7673d4 sfseq:3 ssnoff:ad3d00f4 maplen:2Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify MPTCP counters:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
36.3. Using iproute2 to temporarily configure and enable multiple paths for MPTCP applications Copiar enlaceEnlace copiado en el portapapeles!
Each MPTCP connection uses a single subflow similar to plain TCP. To get the MPTCP benefits, specify a higher limit for maximum number of subflows for each MPTCP connection. Then configure additional endpoints to create those subflows.
The configuration in this procedure will not persist after rebooting your machine.
Note that MPTCP does not yet support mixed IPv6 and IPv4 endpoints for the same socket. Use endpoints belonging to the same address family.
Prerequisites
-
The
mptcpdpackage is installed -
The
iperf3package is installed Server network interface settings:
-
enp4s0:
192.0.2.1/24 -
enp1s0:
198.51.100.1/24
-
enp4s0:
Client network interface settings:
-
enp4s0f0:
192.0.2.2/24 -
enp4s0f1:
198.51.100.2/24
-
enp4s0f0:
Procedure
Configure the client to accept up to 1 additional remote address, as provided by the server:
ip mptcp limits set add_addr_accepted 1
# ip mptcp limits set add_addr_accepted 1Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add IP address
198.51.100.1as a new MPTCP endpoint on the server:ip mptcp endpoint add 198.51.100.1 dev enp1s0 signal
# ip mptcp endpoint add 198.51.100.1 dev enp1s0 signalCopy to Clipboard Copied! Toggle word wrap Toggle overflow The
signaloption ensures that theADD_ADDRpacket is sent after the three-way-handshake.Start the
iperf3server, and force it to create MPTCP sockets instead of TCP sockets:mptcpize run iperf3 -s
# mptcpize run iperf3 -s Server listening on 5201Copy to Clipboard Copied! Toggle word wrap Toggle overflow Connect the client to the server, and force it to create MPTCP sockets instead of TCP sockets:
mptcpize iperf3 -c 192.0.2.1 -t 3
# mptcpize iperf3 -c 192.0.2.1 -t 3Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify the connection is established:
ss -nti '( sport :5201 )'
# ss -nti '( sport :5201 )'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the connection and IP address limit:
ip mptcp limit show
# ip mptcp limit showCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the newly added endpoint:
ip mptcp endpoint show
# ip mptcp endpoint showCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify MPTCP counters by using the
nstat MPTcp*command on a server:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
36.4. Permanently configuring multiple paths for MPTCP applications Copiar enlaceEnlace copiado en el portapapeles!
You can configure MultiPath TCP (MPTCP) by using the nmcli command to permanently establish multiple subflows between a source and destination system.
The subflows can use different resources, different routes to the destination, and even different networks. Such as Ethernet, cellular, wifi, and so on. As a result, you achieve combined connections, which increase network resilience and throughput.
The server uses the following network interfaces in our example:
-
enp4s0:
192.0.2.1/24 -
enp1s0:
198.51.100.1/24 -
enp7s0:
192.0.2.3/24
The client uses the following network interfaces in our example:
-
enp4s0f0:
192.0.2.2/24 -
enp4s0f1:
198.51.100.2/24 -
enp6s0:
192.0.2.5/24
Prerequisites
- You configured the default gateway on the relevant interfaces.
Procedure
Enable MPTCP sockets in the kernel:
echo "net.mptcp.enabled=1" > /etc/sysctl.d/90-enable-MPTCP.conf sysctl -p /etc/sysctl.d/90-enable-MPTCP.conf
# echo "net.mptcp.enabled=1" > /etc/sysctl.d/90-enable-MPTCP.conf # sysctl -p /etc/sysctl.d/90-enable-MPTCP.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: The RHEL kernel default for subflow limit is 2. If you require more:
Create the
/etc/systemd/system/set_mptcp_limit.servicefile with the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The oneshot unit executes the
ip mptcp limits set subflows 3command after your network (network.target) is operational during every boot process.The
ip mptcp limits set subflows 3command sets the maximum number of additional subflows for each connection, so 4 in total. It is possible to add maximally 3 additional subflows.Enable the
set_mptcp_limitservice:systemctl enable --now set_mptcp_limit
# systemctl enable --now set_mptcp_limitCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Enable MPTCP on all connection profiles that you want to use for connection aggregation:
nmcli connection modify <profile_name> connection.mptcp-flags signal,subflow,also-without-default-route
# nmcli connection modify <profile_name> connection.mptcp-flags signal,subflow,also-without-default-routeCopy to Clipboard Copied! Toggle word wrap Toggle overflow The
connection.mptcp-flagsparameter configures MPTCP endpoints and the IP address flags. If MPTCP is enabled in a NetworkManager connection profile, the setting will configure the IP addresses of the relevant network interface as MPTCP endpoints.By default, NetworkManager does not add MPTCP flags to IP addresses if there is no default gateway. If you want to bypass that check, you need to use the
also-without-default-routeflag.
Verification
Verify that you enabled the MPTCP kernel parameter:
sysctl net.mptcp.enabled
# sysctl net.mptcp.enabled net.mptcp.enabled = 1Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that you set the subflow limit correctly, in case the default was not enough:
ip mptcp limit show
# ip mptcp limit show add_addr_accepted 2 subflows 3Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that you configured the per-address MPTCP setting correctly:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
36.5. Monitoring MPTCP sub-flows Copiar enlaceEnlace copiado en el portapapeles!
Monitoring MPTCP (Multipath TCP) subflows is crucial for optimizing performance, ensuring reliability, and maintaining control over multi-path network communication.
The life cycle of a multipath TCP (MPTCP) socket can be complex: The main MPTCP socket is created, the MPTCP path is validated, one or more sub-flows are created and eventually removed. Finally, the MPTCP socket is terminated.
The MPTCP protocol allows monitoring MPTCP-specific events related to socket and sub-flow creation and deletion, using the ip utility provided by the iproute package. This utility uses the netlink interface to monitor MPTCP events.
This procedure demonstrates how to monitor MPTCP events. For that, it simulates a MPTCP server application, and a client connects to this service. The involved clients in this example use the following interfaces and IP addresses:
-
Server:
192.0.2.1 -
Client (Ethernet connection):
192.0.2.2 -
Client (WiFi connection):
192.0.2.3
To simplify this example, all interfaces are within the same subnet. This is not a requirement. However, it is important that routing has been configured correctly, and the client can reach the server via both interfaces.
Prerequisites
- A RHEL client with two network interfaces, such as a laptop with Ethernet and WiFi
- The client can connect to the server via both interfaces
- A RHEL server
- Both the client and the server run RHEL 9.0 or later
-
You installed the
mptcpdpackage on both the client and the server
Procedure
Set the per connection additional subflow limits to
1on both client and server:ip mptcp limits set add_addr_accepted 0 subflows 1
# ip mptcp limits set add_addr_accepted 0 subflows 1Copy to Clipboard Copied! Toggle word wrap Toggle overflow On the server, to simulate a MPTCP server application, start
netcat(nc) in listen mode with enforced MPTCP sockets instead of TCP sockets:mptcpize run nc -l -k -p 12345
# mptcpize run nc -l -k -p 12345Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
-koption causes thatncdoes not close the listener after the first accepted connection. This is required to demonstrate the monitoring of sub-flows.On the client:
Identify the interface with the lowest metric:
ip -4 route
# ip -4 route 192.0.2.0/24 dev enp1s0 proto kernel scope link src 192.0.2.2 metric 100 192.0.2.0/24 dev wlp1s0 proto kernel scope link src 192.0.2.3 metric 600Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
enp1s0interface has a lower metric thanwlp1s0. Therefore, RHEL usesenp1s0by default.On the first terminal, start the monitoring:
ip mptcp monitor
# ip mptcp monitorCopy to Clipboard Copied! Toggle word wrap Toggle overflow On the second terminal, start a MPTCP connection to the server:
mptcpize run nc 192.0.2.1 12345
# mptcpize run nc 192.0.2.1 12345Copy to Clipboard Copied! Toggle word wrap Toggle overflow RHEL uses the
enp1s0interface and its associated IP address as a source for this connection.On the monitoring terminal, the
ip mptcp monitorcommand now logs:[ CREATED] token=63c070d2 remid=0 locid=0 saddr4=192.0.2.2 daddr4=192.0.2.1 sport=36444 dport=12345
[ CREATED] token=63c070d2 remid=0 locid=0 saddr4=192.0.2.2 daddr4=192.0.2.1 sport=36444 dport=12345Copy to Clipboard Copied! Toggle word wrap Toggle overflow The token identifies the MPTCP socket as an unique ID, and later it enables you to correlate MPTCP events on the same socket.
On the terminal with the running
ncconnection to the server, press Enter. This first data packet fully establishes the connection. Note that, as long as no data has been sent, the connection is not established.On the monitoring terminal,
ip mptcp monitornow logs:[ ESTABLISHED] token=63c070d2 remid=0 locid=0 saddr4=192.0.2.2 daddr4=192.0.2.1 sport=36444 dport=12345
[ ESTABLISHED] token=63c070d2 remid=0 locid=0 saddr4=192.0.2.2 daddr4=192.0.2.1 sport=36444 dport=12345Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Display the connections to port
12345on the server:ss -taunp | grep ":12345"
# ss -taunp | grep ":12345" tcp ESTAB 0 0 192.0.2.2:36444 192.0.2.1:12345Copy to Clipboard Copied! Toggle word wrap Toggle overflow At this point, only one connection to the server has been established.
On a third terminal, create another endpoint:
ip mptcp endpoint add dev wlp1s0 192.0.2.3 subflow
# ip mptcp endpoint add dev wlp1s0 192.0.2.3 subflowCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command sets the name and IP address of the WiFi interface of the client in this command.
On the monitoring terminal,
ip mptcp monitornow logs:[SF_ESTABLISHED] token=63c070d2 remid=0 locid=2 saddr4=192.0.2.3 daddr4=192.0.2.1 sport=53345 dport=12345 backup=0 ifindex=3
[SF_ESTABLISHED] token=63c070d2 remid=0 locid=2 saddr4=192.0.2.3 daddr4=192.0.2.1 sport=53345 dport=12345 backup=0 ifindex=3Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
locidfield displays the local address ID of the new sub-flow and identifies this sub-flow even if the connection uses network address translation (NAT). Thesaddr4field matches the endpoint’s IP address from theip mptcp endpoint addcommand.Optional: Display the connections to port
12345on the server:ss -taunp | grep ":12345"
# ss -taunp | grep ":12345" tcp ESTAB 0 0 192.0.2.2:36444 192.0.2.1:12345 tcp ESTAB 0 0 192.0.2.3%wlp1s0:53345 192.0.2.1:12345Copy to Clipboard Copied! Toggle word wrap Toggle overflow The command now displays two connections:
-
The connection with source address
192.0.2.2corresponds to the first MPTCP sub-flow that you established previously. -
The connection from the sub-flow over the
wlp1s0interface with source address192.0.2.3.
-
The connection with source address
On the third terminal, delete the endpoint:
ip mptcp endpoint delete id 2
# ip mptcp endpoint delete id 2Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the ID from the
locidfield from theip mptcp monitoroutput, or retrieve the endpoint ID using theip mptcp endpoint showcommand.On the monitoring terminal,
ip mptcp monitornow logs:[ SF_CLOSED] token=63c070d2 remid=0 locid=2 saddr4=192.0.2.3 daddr4=192.0.2.1 sport=53345 dport=12345 backup=0 ifindex=3
[ SF_CLOSED] token=63c070d2 remid=0 locid=2 saddr4=192.0.2.3 daddr4=192.0.2.1 sport=53345 dport=12345 backup=0 ifindex=3Copy to Clipboard Copied! Toggle word wrap Toggle overflow On the first terminal with the
ncclient, press Ctrl+C to terminate the session.On the monitoring terminal,
ip mptcp monitornow logs:[ CLOSED] token=63c070d2
[ CLOSED] token=63c070d2Copy to Clipboard Copied! Toggle word wrap Toggle overflow
36.6. Disabling Multipath TCP in the kernel Copiar enlaceEnlace copiado en el portapapeles!
If you do not require MPTCP, you can explicitly disable the MPTCP option in the kernel.
Procedure
Disable the
mptcp.enabledoption.echo "net.mptcp.enabled=0" > /etc/sysctl.d/90-enable-MPTCP.conf sysctl -p /etc/sysctl.d/90-enable-MPTCP.conf
# echo "net.mptcp.enabled=0" > /etc/sysctl.d/90-enable-MPTCP.conf # sysctl -p /etc/sysctl.d/90-enable-MPTCP.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify whether the
mptcp.enabledis disabled in the kernel.sysctl -a | grep mptcp.enabled
# sysctl -a | grep mptcp.enabled net.mptcp.enabled = 0Copy to Clipboard Copied! Toggle word wrap Toggle overflow