首页 > 其他分享 >Setup Multipath TCP

Setup Multipath TCP

时间:2024-07-10 17:29:51浏览次数:8  
标签:MPTCP Setup sudo TCP server Multipath your mptcp

https://medium.com/@iheb.zannina/setup-mptcpv1-in-linux-v5-6-9b5e48173b5b

 

 

Setup Multipath TCP

Iheb Zannina  

Iheb Zannina

·

Follow

5 min read · Mar 23, 2023  

     

Abstract

MPTCP, or Multipath TCP, is important because it addresses some of the limitations of traditional TCP connections. TCP is a widely used protocol for reliable data transfer over the internet. However, it is designed to operate over a single network path, which can lead to problems when there is congestion or failure on that path. In such cases, TCP can experience long delays, timeouts, and retransmissions, which can degrade the performance of the connection.

MPTCP can also distribute the load across multiple paths, which can help prevent congestion and improve the overall performance of the connection. MPTCP not only increases robustness during time of
path failure, but also potentially achieves higher end-to-end throughput.

 

Notice: The Nay, Nay, Nay nightmare

Please note, that MPTCPv1 is not compatible with MPTCPv0. Therefore, don’t ever try to test this demo with the official MPTCP website, unfortunately the website is linked to an out-of-tree MPTCP kernel.

Not mentioned in the documentation, that’s why i am telling you that. Honestly, I spent a lot of time looping around to just verify if my MPTCP working good (No traffic blocking). In the website it says you need to type
"curl https://multipath-tcp.org" , sounds easy hah. Indeed, somehow I got this:

$ curl https://multipath-tcp.org
Nay, Nay, Nay, your have an old computer that does not speak MPTCP.
Shame on you!

The shame is not on you my friend, it is on them. No need to worry, you are running a better version, they can’t understand you.

However, if you would verify if your MPTCP is enabled, just type

$ sudo sysctl net.mptcp.enabled
net.mptcp.enabled = 1

Of course you can affect to this variable either (0 or 1). 1 means true , 0 means false. As we said, the Linux kernel above 5.6 already implements MPTCPv1, so it should be 1 by default and you are ready to go.

 

Getting started

Prerequisites

The following packages needs to be installed on your system:

Scenario

During this test, I am going to use 2 Ubuntu laptops running the V5.15 Linux kernel. One laptop will work as a client and the other one as a server.

Configure routing

You can do it manually (very cumbersome) ← Not recommended
Or skip to the best part: ← Recommended : Configure this in both laptops

Place this script inside /etc/network/if-up.d/ and make it executable. (Name the file: mptcp_up)

Also, place this script inside /etc/network/if-post-down.d/ and make it executable. (Name the file: mptcp_down)

If your laptops are linked to each other through your LAN network, then you don’t need these steps. The DHCP server gonna serve you. The main thing is that your laptops can ping each others.

 

Server configuration

Set the total number of allowed sub-flows (whether they are initiated locally or by the peer) to 1. 1 because In our case, we need just another one sub-flow for the WLAN interface. This max number limit, depends on how much interfaces (a.k.a sub-flows) you gonna use besides your default interface.

$ sudo ip mptcp limits set subflow 1

Allow the In_kernel path manager to initiate a new sub-flow using <WLAN> interface as source address

$ sudo ip mptcp endpoint add <WLAN ip address> dev <interface name> subflow 
signal

#You can verify with:

$ sudo ip mptcp limit show

Now, for the testing, what we can do, is run iperf3 as a server (lisning on 5201 port), and in the other hand, we can use the (iperf3 -c) as a client in the client laptop to send packets to the server. Or, we can use python to start a web server (listen on 8000 port) in our server, and from the other client laptop, we can access to this server, and download a big file with the WGET command. Both solutions are enough for our tests.
For me I prefer the first one (More reconfigurable).

# MPTCPIZE used to force the application to use MPTCP at the socket 
communication.
$ sudo mptcpize run python -m http.server 8000 //gonna create like a local web server where you can find your local files
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...


# Or start iperf3 server
$ sudo mptcpize run iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

And of course to verify if MPTCP works we can use

$ sudo ip mptcp monitor
#or test if the connection is using MPTCP
$ tcpdump -n -i <interface> tcp | grep mptcp
 

Client configuration

Set the total number of allowed sub-flows (whether they are initiated locally or by the peer) to 1.

$ sudo ip mptcp limits set subflow 1

For best practice you can also activate the bmon application to monitor the traffic in your interfaces.

$ sudo bmon -b

Now we are done, let’s download some files from our web server.

$ sudo mptcpize run wget 10.22.17.33:8000/Downloads/ubuntu-18.04.6-desktop-amd64.iso
#--2023-03-20 #21:15:55-- http://10.22.17.33:8000/Downloads/ubuntu-18.04.6-desktop-amd64.iso
#Connecting to 10.22.17.33:8000... connected.
#HTTP request sent, awaiting response... 200 OK
#Length: 2514124800 (2,3G) [application/x-iso9660-image]
#Saving to: 'ubuntu-18.04.6-desktop-amd64.iso.32'
#o.32 36%[======> ] 882,65M 113MB/s eta 15s

bmon -b shows: Both interfaces are used, and if one goes down the other one still working. In addition, if the interface goes up again it will be used again.

bmon -b: Interfaces monitoring

On the monitoring terminal, ip mptcp monitor now logs:

SF_ESTABLISHED stands for our mptcp join and we can see the tokens exchanged, which are the cryptographic keys in order to add new sub-flow.

 

Related articles

Using Upstream MPTCP in Linux Systems

Monitoring MPTCP subflows

标签:MPTCP,Setup,sudo,TCP,server,Multipath,your,mptcp
From: https://www.cnblogs.com/ztguang/p/18294650

相关文章

  • Profibus转ModbusTCP网关模块连马保与上位机通讯
    Profibus转ModbusTCP网关模块连马保与上位机通讯Profibus转ModbusTCP网关模块(XD-ETHPB20)广泛应用于工业自动化领域。例如,可以将Profibus网络中的传感器数据转换为ModbusTCP协议,实现数据的实时监控和远程控制。本文介绍了如何利用Profibus转ModbusTCP网关(XD-ETHPB20)模块将带有Profi......
  • Linux使用tcpdump命令抓包并使用wireshark分析常见的场景和解读
    使用tcpdump抓包并使用Wireshark分析网络流量是一项重要的网络管理和故障排除技能。以下是一个简单的步骤指南,涵盖了从抓包到分析的常见场景。抓包安装tcpdump在大多数Linux发行版上,您可以使用包管理器安装tcpdump。例如,在基于Debian的系统上:sudoapt-getin......
  • 案例分享:Qt modbusTcp调试工具(读写Byte、Int、DInt、Real、DReal)(当前v1.0.0)
    前言  西门子PLC、台达PLC、法兰克机床等等多年以前玩得比较多,有tcp/ip通讯也有modbus通讯,modbus又分为网络,485,232等。  医疗项目,焊接机器人项目,工控机床项目,数控项目,物联网项目用的挺多的,将关键的通信技术抽离出来,单独弄成工具。  最近调绞车,遇到了modbustcp,正好有设......
  • Profibus转ModbusTCP网关模块实现Profibus_DP向ModbusTCP转换
    Profibus转ModbusTCP网关模块实现Profibus_DP向ModbusTCP转换Profibus和ModbusTCP是工业控制自动化常用的二种通信协议。Profibus是一种串口通信协议,它提供了迅速靠谱的数据传输和各种拓扑结构,如总线和星型构造。Profibus可以和感应器、执行器、PLC等各类设备进行通信。ModbusTC......
  • Linux系统运维命令:查看http的并发请求数及其TCP连接状态(使用netstat结合awk和sort,组合
    一、需求二、解决方法(一)解决思路(二)命令三、实例演示和命令解释(一)实例演示(二)命令解释四、扩展一、需求用户访问一个视频监控平台的web服务特别频繁,据客户说,有大概2000个用户,要随机访问这个视频监控平台,这样对带宽的要求非常大。因此,他们需要查看到底有多少个http的并......
  • TCP基础
    TCP(传输控制协议,TransmissionControlProtocol)是互联网协议套件中的核心协议之一,提供可靠、有序和错误检查的数据传输。以下是对TCP的详细讲解,帮助你理解它的工作原理及其在固件和软件通信中的应用。1.基本概念TCP是一种面向连接的协议,主要特点包括:可靠性:TCP保证数据包的传输......
  • nginx作为反向代理服务器:代理MySQL、Postgresql、Redis及多个TCP服务
    使用Nginx作为反向代理服务器,可以代理MySQL、PostgreSQL、Redis及多个TCP服务。这需要配置Nginx的stream模块。以下是详细的配置步骤:1.确保Nginx支持stream模块首先,确保Nginx已经编译并支持stream模块。运行以下命令检查:nginx-V在输出中查找--with-str......
  • TCP/IP模型和OSI模型的区别(面试题)
    OSI模型,是国际标准化组织ISO制定的用于计算机或通讯系统键互联的标准化体系,主要分为7个层级:物理层数据链路层网络层传输层会话层表示层应用层虽然OSI模型在理论上更全面,但是在实际网络通讯中,TCP/IP模型更加实用,TCP/IP分为四个层级:应用层传输层网际层网络接口层应用层:该层对......
  • tcp 中的poll机制介绍
    加入poll或者select机制可以使程序更加健壮和高效,特别是在需要处理多个连接时。虽然上面的示例是基于单线程的accept和read,它只能处理一个连接,直到它结束才能处理下一个连接。这种方法在简单应用中可能足够,但在实际生产环境中,通常会遇到需要同时处理多个连接的情况。......
  • 如何完美解决 “error pulling image configuration: download failed after attempts
    如何完美解决"errorpullingimageconfiguration:downloadfailedafterattempts=6:dialtcp59.188.250.54"......