Ubuntu16.0配置MPTCP

Ubuntu16.0配置MPTCP一.在Ubuntu16.0下配置并编译MPTCP1.安装依赖环境-sudoapt-getupdate-sudoapt-getinstalllibncurses5-dev-sudoapt-getinstallbuild-essential2.下载MPTCP源码-cd/usr/src-sudogitclonedepth=1git://github.com/multipath-tcp/mptcp.git-cdmptcp3.配置编译内核

一.在Ubuntu16.0下配置并编译MPTCP
1.安装依赖环境

sudo apt-get update
sudo apt-get install libncurses5-dev
sudo apt-get install build-essential

2.下载MPTCP源码

cd /usr/src
sudo git clone --depth=1 git://github.com/multipath-tcp/mptcp.git
cd mptcp

3.配置编译内核

sudo make menuconfig

PS:如果出现错误提示:
在这里插入图片描述

则下载缺少的依赖包

sudo apt-get install bison flex

配置内核Tips:

 1. 每一个条目,(1)选择y表示编译到内核,条目前括号内的内容显示为<*>[*];(2)选择n表示不编译到内核中,条目前显示为<>[ ];(3)选择m表示以模块的方式编译,之后使用需要加载该模块才可以,条目前显示为<M>[M]2. 进入networking support->networking options,检查一下IPv6模块,选择编译进内核或者不编译,不要选择以模块方式编译,否则看不到后面的MPTCP选项。这里我选择编译到内核。
 3. networking support->networking options->TCP/IP networking->MPTCP protocol(MPTCP),按y选择编译。
 4. Networking support->Networking options->IP: advanced router->IP: policy routing,按y选择编译。
 5. MPTCP: advanced path-manager control,编译。进到里面,编译MPTCP Full-Mesh Path-Manager和MPTCP ndiff-ports。下面的Default MPTCP Path-Manager 选择Full mesh。
 6. Networking support->Networking options->TCP: advanced congestion control,进入。这里是拥塞控制算法,需要哪些就选择哪些,*编译到内核,M是编译成模块。这里选择CUBIC ,Vegas,Veno,LIA(MPTCP Link Increase)Olia (MPTCP Opportunistic Linked Increase),wVegas,Balia。选择默认的算法。
 7. Networking support->Networking options-> “Schedule”都选上,默认选择Round Robin(Default选择的是最小RTT)。
 8. 保存配置,退出

4.编译内核

cd /usr/src/mptcp
sudo make

5.编译并安装模块

sudo make modules_install

6.安装

sudo make install

7.重启系统
重启系统,重启以后要进入新编译好的内核中,在开机的时候选择ubuntu高级选项,找到刚刚编译好的内核,选择进入。
8.检查安装的MPTCP版本

dmesg | grep MPTCP

在这里插入图片描述

9.检查是否在使用MPTCP
网址

参考链接
网址

二。配置路由

自动配置
1.编辑mptcp_up

cd /etc/network/if-up.d
sudo gedit mptcp_up

复制粘贴以下内容,保存退出

#!/bin/sh
# A script for setting up routing tables for MPTCP in the N950.

# Copy this script into /etc/network/if-up.d/

set -e

env > /etc/network/if_up_env

if [ "$IFACE" = lo -o "$MODE" != start ]; then
        exit 0
fi

if [ -z $DEVICE_IFACE ]; then
    exit 0
fi

# FIRST, make a table-alias
if [ `grep $DEVICE_IFACE /etc/iproute2/rt_tables | wc -l` -eq 0 ]; then
    NUM=`cat /etc/iproute2/rt_tables | wc -l`
    echo "$NUM $DEVICE_IFACE" >> /etc/iproute2/rt_tables
fi

if [ $DHCP4_IP_ADDRESS ]; then
    SUBNET=`echo $IP4_ADDRESS_0 | cut -d \   -f 1 | cut -d / -f 2`
    ip route add table $DEVICE_IFACE to $DHCP4_NETWORK_NUMBER/$SUBNET dev $DEVICE_IFACE scope link
    ip route add table $DEVICE_IFACE default via $DHCP4_ROUTERS dev $DEVICE_IFACE
    ip rule add from $DHCP4_IP_ADDRESS table $DEVICE_IFACE
else
    # PPP-interface
    IPADDR=`echo $IP4_ADDRESS_0 | cut -d \   -f 1 | cut -d / -f 1`
    ip route add table $DEVICE_IFACE default dev $DEVICE_IP_IFACE scope link
    ip rule add from $IPADDR table $DEVICE_IFACE
fi

设置文件可执行(root下)

sudo chmod a+x mptcp_up

2.编辑mptcp_down

cd /etc/network/if-post-down.d
sudo gedit mptcp_down

复制粘贴以下内容,保存退出

#!/bin/sh
# A script for setting up routing tables for MPTCP in the N950.

# Copy this script into /etc/network/if-post-down.d/

set -e

env > /etc/network/if_down_env

if [ "$IFACE" = lo -o "$MODE" != stop ]; then
        exit 0
fi

ip rule del table $DEVICE_IFACE
ip route flush table $DEVICE_IFACE

设置文件可执行(root下)

sudo chmod a+x mptcp_down

上述两个脚本根据环境变量配置路由表,绝大多数情况下可以正常工作。还可以参考手动配置路由

三.更改调度算法(有问题 尚未解决)

更改前执行sudo make menuconfig命令时,MPTCP:advanced scheduler control有以下这几个选项:在这里插入图片描述
1.对Kconfig文件添加语句

#
# MPTCP configuration
# config MPTCP
        bool "MPTCP protocol"
        depends on (IPV6=y || IPV6=n)
        ---help---
          This replaces the normal TCP stack with a Multipath TCP stack,
          able to use several paths at once.

menuconfig MPTCP_PM_ADVANCED
	bool "MPTCP: advanced path-manager control"
	depends on MPTCP=y
	---help---
	  Support for selection of different path-managers. You should choose 'Y' here,
	  because otherwise you will not actively create new MPTCP-subflows.

if MPTCP_PM_ADVANCED

config MPTCP_FULLMESH
	tristate "MPTCP Full-Mesh Path-Manager"
	depends on MPTCP=y
	---help---
	  This path-management module will create a full-mesh among all IP-addresses.

config MPTCP_NDIFFPORTS
	tristate "MPTCP ndiff-ports"
	depends on MPTCP=y
	---help---
	  This path-management module will create multiple subflows between the same
	  pair of IP-addresses, modifying the source-port. You can set the number
	  of subflows via the mptcp_ndiffports-sysctl.

config MPTCP_BINDER
	tristate "MPTCP Binder"
	depends on (MPTCP=y)
	---help---
	  This path-management module works like ndiffports, and adds the sysctl
	  option to set the gateway (and/or path to) per each additional subflow
	  via Loose Source Routing (IPv4 only).

config MPTCP_NETLINK
	tristate "MPTCP Netlink Path-Manager"
	depends on MPTCP=y
	---help---
	  This path-management module is controlled over a Netlink interface. A userspace
	  module can therefore control the establishment of new subflows and the policy
	  to apply over those new subflows for every connection.

choice
	prompt "Default MPTCP Path-Manager"
	default DEFAULT_DUMMY
	help
	  Select the Path-Manager of your choice

	config DEFAULT_FULLMESH
		bool "Full mesh" if MPTCP_FULLMESH=y

	config DEFAULT_NDIFFPORTS
		bool "ndiff-ports" if MPTCP_NDIFFPORTS=y

	config DEFAULT_BINDER
		bool "binder" if MPTCP_BINDER=y

	config DEFAULT_NETLINK
		bool "Netlink" if MPTCP_NETLINK=y

	config DEFAULT_DUMMY
		bool "Default"

endchoice

endif

config DEFAULT_MPTCP_PM
	string
	default "default" if DEFAULT_DUMMY
	default "fullmesh" if DEFAULT_FULLMESH
	default "ndiffports" if DEFAULT_NDIFFPORTS
	default "binder" if DEFAULT_BINDER
	default "default"

menuconfig MPTCP_SCHED_ADVANCED
	bool "MPTCP: advanced scheduler control"
	depends on MPTCP=y
	---help---
	  Support for selection of different schedulers. You should choose 'Y' here,
	  if you want to choose a different scheduler than the default one.

if MPTCP_SCHED_ADVANCED

config MPTCP_BLEST
	tristate "MPTCP BLEST"
	depends on MPTCP=y
	---help---
	  This is an experimental BLocking ESTimation-based (BLEST) scheduler.

config MPTCP_ROUNDROBIN
	tristate "MPTCP Round-Robin"
	depends on (MPTCP=y)
	---help---
	  This is a very simple round-robin scheduler. Probably has bad performance
	  but might be interesting for researchers.

config MPTCP_REDUNDANT
	tristate "MPTCP Redundant"
	depends on (MPTCP=y)
	---help---
	  This scheduler sends all packets redundantly over all subflows to decreases
	  latency and jitter on the cost of lower throughput.
	  
config MPTCP_SCHEWZX
	tristate "MPTCP Sche_wzx"
	depends on (MPTCP=y)
	---help---
	  This scheduler created by wzx in 2021/10/12 for test.

choice
	prompt "Default MPTCP Scheduler"
	default DEFAULT_SCHEDULER
	help
	  Select the Scheduler of your choice

	config DEFAULT_SCHEDULER
		bool "Default"
		---help---
		  This is the default scheduler, sending first on the subflow
		  with the lowest RTT.

	config DEFAULT_ROUNDROBIN
		bool "Round-Robin" if MPTCP_ROUNDROBIN=y
		---help---
		  This is the round-rob scheduler, sending in a round-robin
		  fashion..

	config DEFAULT_REDUNDANT
		bool "Redundant" if MPTCP_SCHEWZX=y
		---help---
		  This is the redundant scheduler, sending packets redundantly over
		  all the subflows.
		  
		  
	config DEFAULT_SCHEWZX
		bool "schewzx" if MPTCP_REDUNDANT=y
		---help---
		  This scheduler created by wzx in 2021/10/12 for test.

endchoice
endif

config DEFAULT_MPTCP_SCHED
	string
	depends on (MPTCP=y)
	default "default" if DEFAULT_SCHEDULER
	default "roundrobin" if DEFAULT_ROUNDROBIN
	default "redundant" if DEFAULT_REDUNDANT
	default "schewzx" if DEFAULT_SCHEWZX
	default "default"


2.对Makefile增加语句

#
## Makefile for MultiPath TCP support code.
#
# obj-$(CONFIG_MPTCP) += mptcp.o

mptcp-y := mptcp_ctrl.o mptcp_ipv4.o mptcp_pm.o \
	   mptcp_output.o mptcp_input.o mptcp_sched.o

obj-$(CONFIG_TCP_CONG_LIA) += mptcp_coupled.o
obj-$(CONFIG_TCP_CONG_OLIA) += mptcp_olia.o
obj-$(CONFIG_TCP_CONG_WVEGAS) += mptcp_wvegas.o
obj-$(CONFIG_TCP_CONG_BALIA) += mptcp_balia.o
obj-$(CONFIG_TCP_CONG_MCTCPDESYNC) += mctcp_desync.o
obj-$(CONFIG_MPTCP_FULLMESH) += mptcp_fullmesh.o
obj-$(CONFIG_MPTCP_NDIFFPORTS) += mptcp_ndiffports.o
obj-$(CONFIG_MPTCP_BINDER) += mptcp_binder.o
obj-$(CONFIG_MPTCP_NETLINK) += mptcp_netlink.o
obj-$(CONFIG_MPTCP_ROUNDROBIN) += mptcp_rr.o
obj-$(CONFIG_MPTCP_REDUNDANT) += mptcp_redundant.o
obj-$(CONFIG_MPTCP_BLEST) += mptcp_blest.o
obj-$(CONFIG_MPTCP_SCHEWZX) += mptcp_wzx.o

mptcp-$(subst m,y,$(CONFIG_IPV6)) += mptcp_ipv6.o

3.终端执行命令

make CONFIG_MPTCP_SCHEWZX=m -C /usr/src/mptcp M=/usr/src/mptcp/net/mptcp modules

执行命令后再执行 sudo make menuconfig 出现新的调度算法:
在这里插入图片描述
但是模块前的编译方式是<>表示不编译到内核
4.按照教程,后续步骤为将产生的.ko文件拷贝到/lib/modules/2.6.19/kernel/对应的目录即可。再运行depmod -a重新配置依赖关系,以后就可以通过modprobe mptcp来加载mptcp模块了。没找到这个kernel文件夹,所以就没执行这一步骤。且手欠把新产生的文件都给删了,就无法产生新文件了,咱也不知道咋回事。

今天的文章Ubuntu16.0配置MPTCP分享到此就结束了,感谢您的阅读。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/7706.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注