SDN实战: Practice SDN/OpenFlow with LINC-Switch and OpenDaylight

SDN IN ACTION: Practice SDN/OpenFlow with LINC-Switch and OpenDaylight

薛国锋  [email protected]

本次实验,重点学习了Erlang语言、LINC软件OpenFlow交换机以及OpenDaylight开源控制器。

Last time we had built anemulated environment based on ONOS and Mininet, today we are going to play with LINC-Switch and OpenDaylight to have a deep understanding of SDN/OpenFlow, and we will also try to get some hands-on experiences with RESTful APIs and RestConf. 3 VMs - LINC-Swtich, GNS3 and OpenDaylight are created in this lab and below is the physical and logical design and topology:

1 Set up the VM-LINC-Switch

https://github.com/FlowForwarding/LINC-Switch

https://klyr.quicheaters.org/blog/playing-with-the-erlang-linc-switch.html

Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging (such as What‘s App). Erlang‘s runtime system has built-in support for concurrency,distribution and fault tolerance.

Install defaultJRE/JDK:

 

sudo apt-get update

sudo apt-get install default-jre

sudo apt-get install default-jdk

Install some required system packages to build Erlang from sources:

sudo apt-get install gcc wgetmake autoconf openssl libssl1.0.0 libssl-dev libncurses5 libncurses5-dev

Download Erlang/OTP17.0 Source Files and unpack into the home directory:

http://www.erlang.org/downloads/17.0


Comple and Install Erlang/OTP 17.0:

cd ~/otp_src_17.0

./configure

make

sudo make install

LINC is a pure OpenFlow software switch written in Erlang.It‘s implemented in operating system‘s userspace as an Erlang node. Such approach is not the most efficient one, but it gives a lot of flexibility and allows quick development and testing of new OpenFlow features.

Install theadditional libraries and tools to build LINC-Swtich from sources:

sudo apt-get install git-core bridge-utils libpcap0.8 libpcap-dev libcap2-bin uml-utilities

Clone the gitrepository

git clone https://github.com/FlowForwarding/LINC-Switch.git

Compile LINC-Switch:

 

cd ~/LINC-Switch/rel/files

mv sys.config.orig sys.config

cd ~/LINC-Switch

make

Virtual Ethernet interfaces which always come in pair, can serveas the both ends of a tunnel and connect two entities in Linux. Create 3 pairs ofveth interfaces for 3 LINC-Swtiches:

sudo ip link add veth12 type veth peer name veth21

sudo ip link set veth12 up

sudo ip link set veth21 up

sudo ip link add veth13 typeveth peer name veth31

sudo ip link set veth13 up

sudo ip link set veth31 up

sudo ip link add veth23 typeveth peer name veth32

sudo ip link set veth23 up

sudo ip link set veth32 up

The config_gen script supports configuring multiple logicalswitches as well as using eth, tap and veth interfaces. Create 3 switches with the same controller and generate the configuration file to start LINC-Swtich:

cd ~

./LINC-Switch/scripts/config_gen-s 1 eth1 veth12 veth13 -s 2 eth2 veth21 veth23 -s 3 eth3 veth31 veth32  -c tcp:192.168.100.129:6633 -o ~/LINC-Switch/rel/linc/releases/1.0/sys.config

// s1 with eth1 connecting tos2 by veth12 and s3 by veth13

// s2 with eth2 connecting tos1 by veth21 and s3 by veth23

// s3 with eth3 connecting tos1 by veth31 and s2 by veth32

// s1, s2 and s3 connecting toOpenDaylight by tcp:192.168.100.129:6633

 ~/LINC-Switch/rel/linc/releases/1.0/sys.config which uses Erlang configuration syntax, is automatically generated as the configuration file to start LINC-Swtich:

[{linc,

[{of_config,enabled},   // enabled or disabled

{sync_routing,true},

{capable_switch_ports,

[{port,1,[{interface,"eth1"}]},

{port,2,[{interface,"veth12"}]},

{port,3,[{interface,"veth13"}]},

{port,4,[{interface,"eth2"}]},

{port,5,[{interface,"veth21"}]},

{port,6,[{interface,"veth23"}]},

{port,7,[{interface,"eth3"}]},

{port,8,[{interface,"veth31"}]},

{port,9,[{interface,"veth32"}]}]},

{capable_switch_queues,[]},

{logical_switches,

[{switch,3,                           // s3

[{backend,linc_us4},           // linc_us4 for OpenFlow 1.3

{controllers,

[{"Switch3-Controller","192.168.100.129",6633,tcp}]},

{controllers_listener,disabled},

{queues_status,disabled},

{ports,

[{port,7,[{queues,[]}]},

{port,8,[{queues,[]}]},

{port,9,[{queues,[]}]}]}]},

{switch,2,                         // s2

[{backend,linc_us4},

{controllers,

[{"Switch2-Controller","192.168.100.129",6633,tcp}]},

{controllers_listener,disabled},

{queues_status,disabled},

{ports,

[{port,4,[{queues,[]}]},

{port,5,[{queues,[]}]},

{port,6,[{queues,[]}]}]}]},

{switch,1,                       // s1

[{backend,linc_us4},

{controllers,

[{"Switch1-Controller","192.168.100.129",6633,tcp}]},

{controllers_listener,disabled},

{queues_status,disabled},

{ports,

[{port,1,[{queues,[]}]},

{port,2,[{queues,[]}]},

{port,3,[{queues,[]}]}]}]}]}]},

{enetconf,

[{capabilities,

[{base,{1,0}},

{base,{1,1}},

{startup,{1,0}},

{‘writable-running‘,{1,0}}]},

{callback_module,linc_ofconfig},

{sshd_ip,any},

{sshd_port,1830},

{sshd_user_passwords,[{"linc","linc"}]}]},

{lager,

[{handlers,

[{lager_console_backend,info},         // replace ‘debug’ with ‘info’

{lager_file_backend,

[{"log/error.log",error,10485760,"$D0",5},

{"log/console.log",info,10485760,"$D0",5}]}]}]},

{sasl,

[{sasl_error_logger,{file,"log/sasl-error.log"}},

{errlog_type,error},

{error_logger_mf_dir,"log/sasl"},

{error_logger_mf_maxbytes,10485760},

{error_logger_mf_maxfiles,5}]},

{sync,[{excluded_modules,[procket]}]}].

Start, stop andattach LINC-Swtich :

sudo ~/LINC-Switch/rel/linc/bin/lincstart

sudo~/LINC-Switch/rel/linc/bin/linc console

sudo~/LINC-Switch/rel/linc/bin/linc attach

sudo~/LINC-Switch/rel/linc/bin/linc stop

 

2 Set up theVM-GNS3

The eth1, eth2 and eth3 of GNS3 are respectively connected to the eth1, eth2 and eth3 of LINC-Switch with VMware LAN Segments. Create 3 virtual routers and connect them to S1, S2 and S3 in LINC-Swtich via GNS3 Cloud:

R1#show run

interface FastEthernet0/0

ip address 10.110.0.1 255.255.0.0

R2#show run

interface FastEthernet0/0

ip address 10.110.0.2 255.255.0.0

R3#show run

interface FastEthernet0/0

ip address 10.110.0.3 255.255.0.0

3 Set up the VM-OpenDaylight and test the network

 

While both adopting Java, OSGi and Karaf, OpenDaylight focuses on bringing legacy (BGP, SNMP, and such) and new networks (i.e., OpenFlow andSDN) together whereas ONOS focuses on the performance aspects and theclustering to increase the availability and scalability. Before installingOpenDaylight, install default JRE/JDK first.

Download the official OpenDaylight release (distribution-karaf-0.6.0-Carbon.tar.gz) for production:

https://www.opendaylight.org/technical-community/getting-started-for-developers/downloads-and-documentation

Unpack into the home directory and run it:

Install the the necessary OpenDaylight features withfollowing commands:

feature:install odl-aaa-authn odl-restconf-allodl-dlux-core odl-dluxapps-yangman  odl-dluxapps-topologyodl-l2switch-all webconsole odl-mdsal-apidocs

You can check the below web link for all the OpenDaylightfeatures and descritions:

http://docs.opendaylight.org/en/stable-boron/getting-started-guide/installing_opendaylight.html#listing-available-features

Open a brower on the hostsystem and enter the URL of OpenDaylight ( User/Password:admin/admin ):

http://192.168.100.129:8181/index.html

The topology tab displays a graphical representationof network topology created:

YANG is a human-readablelanguage for describing data device and service models. ODL dynamicallygenerates REST APIs from YANG models (referred to as RESTCONF), thus providingODL apps developers with an immediate baseline set of APIs. YANGMAN is an ODLapplication offering dynamically generated UI forms and native JSON representationbased on RESTCONF APIs:

Try different RESTful APIs in OpenDaylight:

http://192.168.100.129:8181/restconf/operational/network-topology:network-topology

http://192.168.100.129:8181/restconf/operational/network-topology:network-topology/topology/flow:1/node/openflow:844477163529735

http://192.168.100.129:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:844477163529735/table/0

http://192.168.100.129:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:844477163529735/table/0

Simple REST Client is an extension for Google Chrome to help construct custom HTTP requests to directly test the web services. Download is available at: http://chrome.google.com/extensions/detail/fhjcajmcbmldlhcimfajhfbgofnpcjmb

 Try the following commands in LINC-Switch:

([email protected])1> rp(application:get_all_key(linc)).     // show the running configuration

([email protected])2>linc:ports(1).                                     // showall the ports of 1 ( Switch ID)

([email protected])3>linc_logic:get_datapath_id(2).         //show the datapath ID of 2 ( Switch ID)

 

Check the IP connectivity among virtual routers  in GNS3:

时间: 2024-10-20 11:07:24

SDN实战: Practice SDN/OpenFlow with LINC-Switch and OpenDaylight的相关文章

深入SDN(三):SDN、OpenFlow和NOS是什么?

本文解答四个问题: 问题一:What is SDN? 之前根据自己的经验和学习状况回答了如何去研究SDN&OpenFlow?,到底What is SDN? 现有的SDN课程中在介绍SDN时,基本都是两步走: 第一步引用Nick McKeown的观点,类比PC产业,从"Refactoring Functionality"的角度来定义SDN,直接了当非常容易理解,感觉豁然开朗. 第二步引用Scott Shenker的观点,从"Redefining Abstractions

备战SDN 思科收购SDN初创公司BroadHop

2012年12月19,据国外媒体报道,就在瞻博网络刚刚收购Contrail公司后,思科就宣布将收购提供政策控制和服务管理技术公司BroadHop,以增强其为运营商网络提供的产品,交易金融目前还未披露. BroadHop已经创建9年,几年来一直是思科的WiFi合作伙伴.BroadHop的员工将合并到思科的服务提供商网络部门. BroadHop在其"Quantum Network Suite"成套产品之中提供许多产品,包括把服务连接到网络的Quantum政策服务器.基于Eclipse的丰富

SDN实战: Build a mini-lab environment and practice SDN-IP/ONOS with GNS3, Mininet and VMware

SDN IN ACTION: Build a mini-lab environment and practice SDN-IP/ONOS with GNS3, Mininet and VMware    薛国锋  [email protected] 本文主要通过简单的实验,对SDN相关概念以及ONOS开源软件等建立一个感性的印象,加深对核心概念的理解. SDN-IP is to adopt SDN/OpenFlow switches to replace the traditional IP/M

SDN实战:Build a VXLAN Tunnel by Making Python-based API Calls for DCI

SDN IN ACTION: Build a VXLAN tunnel by making Python-based API Calls on OpenDaylight and Provide the DCI service   薛国锋                                      [email protected]   今天做了个小实验,通过Python程序调用OpenDaylight的北向API,在两个DC之间建立VXLAN隧道,实现DCI:DC内部采用Minin

SDN理解:SDN现状

目录 - SDN现状 - (一)SDN现状 - SDN诞生的背景 - SDN的介绍 - (二)SDN领域的相关组织和发展现状 - 1.ONF - 2.OpenDaylight - 3. IETF - 4.ETSI SDN现状 (一)SDN现状 SDN诞生的背景 SDN技术其实要从更往前一点的技术说起,也就是传统(现在主流)TCP/IP协议,得益于TCP/IP的巨大成功,出现 IP over Everything.Everything over IP,以至于大学时期计算机网络课程的内容的基本上就是

深入SDN(一):如何去研究SDN&OpenFlow

本文来自我在知乎上的回答:如何去研究SDN&OpenFlow?:对任何人来讲,时间才是最大的财富,每个人都应该把自己的时间投入到最有意义.最有影响的地方去.经过多年的学习.思考和实践,我认定这样一个规律:技术的发展不是均匀的,而是以浪潮的形式出现.每一个人都应该看清楚浪潮,赶上浪潮,如此,便不枉此生. --<浪潮之巅>吴军记得在孟岩的<一个"技术文化人"的片段感悟>中读到:程序员的进阶之道是"抬头看路,埋头赶路".也许SDN的抬头看路

OpenFlow和SDN的历史和原理介绍

OpenFlow相关的历史.新闻:http://blog.csdn.net/jincm13/article/details/7825754起源与发展[https://36kr.com/p/5035985] OpenFlow起源于斯坦福大学的Clean Slate项目组 [1] .CleanSlate项目的最终目的是要重新发明英特网,旨在改变设计已略显不合时宜,且难以进化发展的现有网络基础架构.在2006年,斯坦福的学生Martin Casado领导了一个关于网络安全与管理的项目Ethane[2]

SDN你必须知道的十大问题——SDN书籍有哪些?

近日,自己开始着手从事SDN研发,相关的知识有一大堆,诸如OpenFlow等,不得不说网络的基础知识是必备的,但是对于新手来说要从茫茫大海一般的知识点中找准方向的确有点困难,因此自己从网上收集了一些具有方向导向性的书籍供大家一起参考 申明:本文转载自:http://www.sdnlab.com/8397.html "腹有诗书气自华",无论是技术技能修炼还是技术修养升华,阅读书籍无疑是一个系统提升"便捷"方式.作为在近些年火热炒作的新兴技术,SDN的发展也不负众望,2

万台规模下的SDN控制器集群部署实践

目前在网络世界里,云计算.虚拟化.SDN.NFV这些话题都非常热.今天借这个机会我跟大家一起来一场SDN的深度之旅,从概念一直到实践一直到一些具体的技术. 本次分享分为三个主要部分: SDN & NFV的背景介绍 SDN部署的实际案例 SDN控制器的集群部署方案 我们首先看一下SDN.其实SDN这个东西已经有好几年了,它强调的是什么?控制平面和数据平面分离,中间是由OpenFlow交换机组成的控制器,再往上就是运行在SDN之上的服务或者是应用.这里强调两个,控制器和交换机的接口——我们叫做南向接