Multipath TCP Test


http://csie.nqu.edu.tw/smallko/sdn/mptcp-test.htm


[Preparation]

Follow the instructions at https://multipath-tcp.org/pmwiki.php/Users/HowToInstallMPTCP?to install MPTCP into your Linux.

Reboot your computer and choose the correctkernel image to boot your computer

 

 

Make sure that you can see the followingmessage. If you cannot see it, it means that the your current linux does notsupport MPTCP

 

 

[Experiment Topology]

[Script]

#!/usr/bin/env python

from mininet.net import Mininet

from mininet.cli import CLI

from mininet.link import Link, TCLink,Intf

from subprocess import Popen, PIPE

from mininet.log import setLogLevel

 

if '__main__' == __name__:

  setLogLevel('info')

  net = Mininet(link=TCLink)

  key = "net.mptcp.mptcp_enabled"

  value = 1

  p = Popen("sysctl -w %s=%s" % (key, value), shell=True, stdout=PIPE, stderr=PIPE)

  stdout, stderr = p.communicate()

  print "stdout=",stdout,"stderr=", stderr

 

  h1 = net.addHost('h1')

  h2 = net.addHost('h2')

  r1 = net.addHost('r1')

  linkopt={'bw':10}

  net.addLink(r1,h1,cls=TCLink, **linkopt)

  net.addLink(r1,h1,cls=TCLink, **linkopt)

  net.addLink(r1,h2,cls=TCLink, **linkopt)

  net.addLink(r1,h2,cls=TCLink, **linkopt)

  net.build()

  r1.cmd("ifconfig r1-eth0 0")

  r1.cmd("ifconfig r1-eth1 0")

  r1.cmd("ifconfig r1-eth2 0")

  r1.cmd("ifconfig r1-eth3 0")

  h1.cmd("ifconfig h1-eth0 0")

  h1.cmd("ifconfig h1-eth1 0")

  h2.cmd("ifconfig h2-eth0 0")

  h2.cmd("ifconfig h2-eth1 0")

  r1.cmd("echo 1 > /proc/sys/net/ipv4/ip_forward")

  r1.cmd("ifconfig r1-eth0 10.0.0.1 netmask 255.255.255.0")

  r1.cmd("ifconfig r1-eth1 10.0.1.1 netmask 255.255.255.0")

  r1.cmd("ifconfig r1-eth2 10.0.2.1 netmask 255.255.255.0")

  r1.cmd("ifconfig r1-eth3 10.0.3.1 netmask 255.255.255.0")

  h1.cmd("ifconfig h1-eth0 10.0.0.2 netmask 255.255.255.0")

  h1.cmd("ifconfig h1-eth1 10.0.1.2 netmask 255.255.255.0")

  h2.cmd("ifconfig h2-eth0 10.0.2.2 netmask 255.255.255.0")

  h2.cmd("ifconfig h2-eth1 10.0.3.2 netmask 255.255.255.0")

  h1.cmd("ip rule add from 10.0.0.2 table 1")

  h1.cmd("ip rule add from 10.0.1.2 table 2")

  h1.cmd("ip route add 10.0.0.0/24 dev h1-eth0 scope link table 1")

  h1.cmd("ip route add default via 10.0.0.1 dev h1-eth0 table 1")

  h1.cmd("ip route add 10.0.1.0/24 dev h1-eth1 scope link table 2")

  h1.cmd("ip route add default via 10.0.1.1 dev h1-eth1 table 2")

  h1.cmd("ip route add default scope global nexthop via 10.0.0.1 dev h1-eth0")

  h2.cmd("ip rule add from 10.0.2.2 table 1")

  h2.cmd("ip rule add from 10.0.3.2 table 2")

  h2.cmd("ip route add 10.0.2.0/24 dev h2-eth0 scope link table 1")

  h2.cmd("ip route add default via 10.0.2.1 dev h2-eth0 table 1")

  h2.cmd("ip route add 10.0.3.0/24 dev h2-eth1 scope link table 2")

  h2.cmd("ip route add default via 10.0.3.1 dev h2-eth1 table 2")

  h2.cmd("ip route add default scope global nexthop via 10.0.2.1 dev h2-eth0")

  CLI(net)

  net.stop()

 

 

[Execution]

When mptcp is enabled.

 

 

Change “value = 0” to disable mptcp

 

[reference]

http://blog.mcchan.io/test-mptcp-with-mininet

 

Dr. Chih-Heng Ke (smallko@gmail.com)

Departmentof Computer Science and Information Engineering,

National Quemoy University, Kinmen,Taiwan.


posted @   张同光  阅读(181)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示