iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 27
1
Software Development

菸酒生 - Software Defined Network系列 第 27

一 Ryu 大師: QoS

  • Purpose:

    • Set the Queue to switch
      • Queue 0 : Max rate: 500Kbps
      • Queue 1: Min rate: 800Kbps
    • Install the following flow entry to the switch.
      https://ithelp.ithome.com.tw/upload/images/20201012/20111516H3KFtyLZYA.png
      Ryubook 1.0 documentation
  • 建立環境

Format: --parameters value

參數 解釋
--mac None 自動幫host設定mac address
--switch ovsk 使用 Open vSwitch
--controller remote external one(Ryu/Pox/Onos)
-x None Start xterm (s1,h1,h2)

Step 1: Mininet Topo

sudo mn --mac --switch ovsk --controller remote -x

https://ithelp.ithome.com.tw/upload/images/20201012/20111516hEBJkCYdBc.png

預設拓樸為

  • 2台 Host(h1,h2)
  • 1台 Switch (s1)
  • 假設 不是 設定 remote 會有一台 mininet 內部簡易的 Controller
    https://ithelp.ithome.com.tw/upload/images/20201012/20111516cCY0TwOCjF.png

  • 設定 OpenFlow 的版本:1.3 , Listen port:6632 以便存取 OVSDB

Step 2: OVS 以及 程式碼 微修改 最後啟動 Ryu App x3 還有 Queue QoS Setting

s1

ovs-vsctl set Bridge s1 protocols=OpenFlow13
ovs-vsctl set-manager ptcp:6632

https://ithelp.ithome.com.tw/upload/images/20201012/20111516q3bP98mCcR.png

c0

sed '/OFPFlowMod(/,/)/s/)/, table_id=1)/' ryu/ryu/app/simple_switch_13.py > ryu/ryu/app/qos_simple_switch_13.py

https://ithelp.ithome.com.tw/upload/images/20201012/20111516Jn0QlITVEI.png

cd ryu/; python ./setup.py install


c0
start ryu.app.rest_qos ryu.app.qos_simple_switch_13 ryu.app.rest_conf_switch

ryu-manager ryu.app.rest_qos ryu.app.qos_simple_switch_13 ryu.app.rest_conf_switch
https://ithelp.ithome.com.tw/upload/images/20201012/201115169kqk2XgQk2.png


  • Queue Setting

c0

curl -X PUT -d '"tcp:127.0.0.1:6632"' http://localhost:8080/v1.0/conf/switches/0000000000000001/ovsdb_addr

https://ithelp.ithome.com.tw/upload/images/20201012/2011151663ckmotoRW.png

curl -X POST -d '{"port_name": "s1-eth1", "type": "linux-htb", "max_rate": "1000000", "queues": [{"max_rate": "500000"}, {"min_rate": "800000"}]}' http://localhost:8080/qos/queue/0000000000000001

https://ithelp.ithome.com.tw/upload/images/20201012/20111516dKHQ0GOzWo.png


  • QoS Setting
    c0

curl -X POST -d '{"match": {"nw_dst": "10.0.0.1", "nw_proto": "UDP", "tp_dst": "5002"}, "actions":{"queue": "1"}}' http://localhost:8080/qos/rules/0000000000000001

https://ithelp.ithome.com.tw/upload/images/20201012/20111516uukEsx0Thy.png

  • Verifying the Setting

curl -X GET http://localhost:8080/qos/rules/0000000000000001

https://ithelp.ithome.com.tw/upload/images/20201012/20111516InBTtqAyKe.png


Step 3: iperf 測試 不同 Port 的最大最小 bandwidth

  • Measuring the bandwidth

兩個 h1: h1(1) h1(2),兩個 h2: h2(1) h2(2)

h1(1)

iperf -s -u -i 1 -p 5001

h1(2)

iperf -s -u -i 1 -p 5002

h2(1)

iperf -c 10.0.0.1 -p 5001 -u -b 1M

h2(2)

iperf -c 10.0.0.1 -p 5002 -u -b 1M

https://ithelp.ithome.com.tw/upload/images/20201012/20111516UHwka88OLw.png

實驗結果:
port 5001: 理論上 不超過 500Kbps
但是 第一個 輸出是 506 Kbps <-- Why ?
port 5002: 至少會有 800Kbps

實驗操作 Tip:
xterm Copy/Paste

  • paste by 滑鼠中間上下滑鍵(scroll)
  • copy by 反白 then scroll 鍵 貼上

Reference:
RYU SDN Framework


上一篇
How to split a (HUGE) pcap file into a set of smaller ones ? keyword: tcpdump
下一篇
一Ryu大師: REST API
系列文
菸酒生 - Software Defined Network30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言