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/MPLS Core, and provide the transit Internet service. The original Tutorial VM provided by ONOS integrates all the components by containers in one virtual machine, which might be hard to understand how thesystem is actually built and works.

This mini-lab provides an emulated environment with 3 VMs, and it could better match the real network world and help explain the key concepts of SDN-IP/ONOS. Before moving forwarding, you can read and complete the below tutorial.In addition, you need to be familiar with Ubuntu, Java/OSGi/Karaf, Python, Mininet/OpenvSwitch, GNS3 with Cisco IOS and VMware Workstation.

https://wiki.onosproject.org/display/ONOS/SDN-IP+Tutorial

1 Introduction of mini-lab design

We will create 3 VMs with multiple network adapters and connect them with VMnet8/NAT and LAN Segment by VMware Workstation in Windows 10:

Physical topology and connections:

Logical network topology and connections:

Actually you can create a complex network topology with more OpenFlow switches in Mininet by Python programming.

2 Set up the VM-Mininet

Download the pre-packaged Mininet/Ubuntu VM, and import it to VMware Workstation. You can select Option 1 in the article: http://mininet.org/download/. Please add 4 network adapters for this VM: Adapter-VMnet8/NAT, Adapter 2-102,Adapter 3-103 and Adapter 4-104.

For the multiple adapters, in order to make the network interface names regular and easier to remember, you can make the following configuration:

 

ifconfig –a

sudo vi /etc/default/grub

sudo update-grub

sudo grub-mkconfig -o /boot/grub/grub.cfg

sudo  gedit/etc/network/interfaces   //  don’t need to config the IP addresses foreth1,eth2 and eth3

Create a Mininet with 3 switches:

sudo mn --controller=remote,ip=192.168.100.129--topo=linear,3  

                                 // 192.168.100.129 is the IP address of controller, VM-ONOS

mininet>sh ovs-vsctl add-port s1 eth2   // add eth2 to s1

mininet>sh ovs-vsctl add-port s2 eth1   // add eth1 to s2

mininet>sh ovs-vsctl add-port s3 eth3   // add eth3 to s3

If the system works properly and after the VM-ONOS is configured and running,you would see the below configuration and status:

In VM-Mininet, you can get the Device ID and Interface ID with the following commands:

sudo ovs-ofctl show s2       // in Ubuntu

mininet>sh ovs-ofctl show s1   // or in Mininet


3 Set up the VM-GNS3

Create an Ubuntu-based VM with 5 network adapters:Adapter-VMnet8/NAT, Adapter 2-102, Adapter 3-103, Adapter 4-104 and Adapter5-105, and make the network interface names regular with the grub configuration.

Install and run GNS3 with the following commands:

sudo add-apt-repository ppa:gns3/ppa

sudo apt-get update

sudo apt-get install gns3-gui

gns3

https://docs.gns3.com/1QXVIihk7dsOL7Xr7Bmz4zRzTsJ02wklfImGuHwTlaA4/index.html

Dynamips is a hypervisor program ( like VMware for X86 platform ) that can emulate C17/26/36/62 seriesrouter hardware, you can quickly and easily configure these router models with a variety of emulated SLOT and NICs in GNS3. Before you can boot up a router,you need to get one IOS image file and install it.

Edit/Preferences/Dynamips/IOS routers:

Create 3 virtual routers and 2 Clouds; with the Cloud in GNS3, you can tie the interface of a virtual router to a physical network interface of VM or Host; in this way,the virtual router can communicate with the real network world.

R1 is the internal BGP Speaker defined in SDN-IP/ONOS, it sits inside SDN network and peers with all the external BGP routers, learning BGP routes from them and relaying those routes to the SDN-IP application running in ONOS.

R1#show run 

interface FastEthernet0/0

 ip address 10.1.2.254 255.255.255.0 secondary

 ip address 10.1.1.254 255.255.255.0

interface FastEthernet0/1

 ip address 10.213.166.94 255.255.255.0

router bgp 65501

 no synchronization

 bgp router-id 10.213.166.94

 bgp log-neighbor-changes

 neighbor 10.1.1.253 remote-as 65502      // EBGP Peer – R2

 neighbor 10.1.2.253 remote-as 65503      // EBGP Peer – R3

 neighbor 10.1.2.253 ebgp-multihop 255

 neighbor 10.1.2.253 next-hop-self

 neighbor 10.213.166.68 remote-as 65501    //IBGP Peer – SDN-IP/ONOS in the same AS

 no auto-summary

R2 and R3 are the externalBGP routers, and they are the ASBRs of other ASs.

R2#show run

interface Loopback0

 ip address 172.18.1.1 255.255.255.0

interface Loopback1

 ip address 172.18.2.1 255.255.255.0

interface FastEthernet0/0

 ip address 10.1.1.253 255.255.255.0

router bgp 65502

 no synchronization

 bgp router-id 10.1.1.253

 bgp log-neighbor-changes

 network 172.18.1.0 mask 255.255.255.0

 network 172.18.2.0 mask 255.255.255.0

 neighbor 10.1.1.254 remote-as 65501

 no auto-summary

 

R3#show run

interface Loopback0

 ip address 172.19.1.1 255.255.255.0

interface Loopback1

 ip address 172.19.2.1 255.255.255.0

interface FastEthernet0/0

 ip address 10.1.2.253 255.255.255.0

router bgp 65503

 no synchronization

 bgp router-id 10.1.2.253

 bgp log-neighbor-changes

 network 172.19.1.0 mask 255.255.255.0

 network 172.19.2.0 mask 255.255.255.0

 neighbor 10.1.2.254 remote-as 65501

 neighbor 10.1.2.254 ebgp-multihop 255

 no auto-summary

4 Set up the VM-ONOS,Install and Run SDN-IP

Create an Ubuntu-based VM with 2 network adapters: Adapter-VMnet8/NAT and Adapter 2-105, and make the network interface names regular with the grub configuration. Install Java and Maven.

Config the static IP addresses for eth1, which speaks to R1:f0/1 in GSN3:

sudo  gedit/etc/network/interfaces  

Downloadthe official ONOS release (tar.gz) for production: https://wiki.onosproject.org/display/ONOS/Downloads

What I downloaded is the version 1.9.2. Put ONOS inthe home directory and run it for the first time.

SDN-IP requires some configuration to know where the internal BGP speakers and external BGP peers are located, and it can respond to ARPs correctly and program the connectivity for the BGP traffic. With the network config subsystem in ONOS, SDN-IP can read and load the configuration file (network-cfg.json) at startup, which has be placed in/home/onos-1.9.2/config:

gedit network-cfg.json

{

   "ports" : {

       "of:0000000000000001/3" : {           

                            // Device ID/Interface ID, Physical location ofR2, connecting to s1:eth2

            "interfaces" : [

                {

                    "name" :"s1-eth2-r2",                //Optional name

                    "ips"  : [ "10.1.1.254/24" ],         // IP address of R1: f0/0

                    "mac"  : "cc:01:17:08:00:00"     //MAC address of R1: f0/0

                }

            ]

       },

       "of:0000000000000003/3" : {

                     // Device ID/Interface ID, Physicallocation of R3, connecting to s3:eth3

            "interfaces" : [

                {

                    "name" :"s3-eth3-r3",              //Optional name

                    "ips"  : [ "10.1.2.254/24" ],      // the secondary IP address of R1: f0/0

                    "mac"  : "cc:01:17:08:00:00"  // MAC address of R1: f0/0

                }

            ]

       }

   },

   "apps" : {

       "org.onosproject.router" : {

            "bgp" : {

                "bgpSpeakers" : [

                    {

                        "name" :"s2-eth1-r1",     // Optionalname

                       "connectPoint" : "of:0000000000000002/4",  

                                        // Device ID/Interface ID, Physical locationof R1, connecting to s2:eth1

                        "peers" : [

                           "10.1.1.253",         //the IP address of peers

                           "10.1.2.253"          //the IP address of peers

                        ]

                    }

               ]

            }

       }

   }

}

The SDN-IP listens by default for incoming BGPconnections on the non-standard TCP port 2000, and 179 is the standard. We can enable the local TCP port mapping between 2000 and 170 with the command of iptables:

sudo iptables -t nat -A PREROUTING -ptcp --dport 179 -j REDIRECT --to-ports 2000

sudo netstat –tln | grep 2000

Install the SDN-IP application and its dependencies with the following commands:

onos>app activateorg.onosproject.config            // letONOS read the configuration file

onos>app activateorg.onosproject.proxyarp

                               // let ONOSrespond to ARP requests between the external BGP peers and internal BGPspeakers

onos>app activate org.onosproject.sdnip             // Install SDNIP

You can also visit the Web UI of ONOS(User/Password:onos/rocks), install and activate the features: http://192.168.100.129:8181/onos/ui/login.html

Please make sure that all the below features have been installed and activated:

A lot happens after running SDN-IP; firstly it installs the p2p intents ( 16 intentsin our case ) to enable the communication between external BGP peers andinternal BGP speakers, allowing the external BGP peers to relay the Internet routes to SDN-IP. When SDN-IP/ONOS learns the routes, it would program those routes into the switches using the mp2p intents ( 4 intents in our case ).

You can try some CLIs in ONOS:

Now you can check the e2e connectivity with GNS3 and virtual routers:

My takeaways

SDN-IP can provide the basic service for Internet transit, but it is still far away from what a production network actually needs in terms of rich features, reliability and easy OAM,comparing to other solutions, such as BGP-free Core or Hollow Core. Service SDN might be good, but by moving the control plane to the controller, we would have to face the technical challenges with Control SDN.

With the Open Source & White Box strategy, the service providers might be able to save some CAPEX, but they have to transform theirorganizations, and make them really capable of DevOps, to maintain theirnetworks and upgrade the software timely. You cannot rely on other PSIs to achieve this core competence.

In the future, what the service providers really need might be the full stack engineers, who should masterLinux/JAVA/OSGi/Felix/Karaf/Maven/JAX-RS/YANG/RestConf&NetConf,OVS/OpenFlow/OVSDB, ONOS, ODL&MD-SAL and Openstack etc, as well as have theCCIE-alike networking experiences. How can the global operators acquire encourage software talents with networking background ?










时间: 2024-10-22 23:36:38

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

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实战: 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

Build Spring MVC development environment

Short memo for how to build Spring MVC develepmnet environment (for windows). In case you have any questions, please feel free to leave message to me under this article. I will update and add more details according to your concern. Firstly, please ma

.Net Core实战教程(二):设置Kestrel的IP与端口的几种方法

.Net Core实战教程(二):设置Kestrel的IP与端口的几种方法 1.直接写在代码方式 Program.cs代码如下: using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using M

实战生成器模式(Builder Pattern In Practice)

原文链接:http://www.javacodegeeks.com/2013/01/the-builder-pattern-in-practice.html 我不会详细介绍这个模式,因为已经有大量的文章或者书籍对该模式进行过详细的解析.我将告诉你的是为什么以及什么时候你应该考虑使用它.值得一提的是,我所介绍的这个模式和设计模式四人帮的书(<设计模式:可复用面向对象软件的基础>)里面的有些许区别.四人帮书里面介绍的生成器模式重点在抽象出对象创建的步骤,并通过调用不同的具体实现从而得到不同的结果,

爬虫实战【13】获取自己的动态代理ip池

在爬取一些比较友好的网站时,仍然有可能因为单位时间内访问次数过多,使服务器认定为机器访问,导致访问失败或者被封.如果我们使用不同的ip来访问网站的话,就可以绕过服务器的重复验证,使服务器以为使不同的人在访问,就不会被封了. 如何获取动态ip 网络上有很多提供代理ip的网站,我们经常使用的一个是西刺免费代理ip,url='http://www.xicidaili.com/' 我们来看一下这个网站的构成: [插入图片,西刺代理页面] 我们获取这个页面上的所有ip即可. 一个合理的代理ip的格式是这样

Mininet+Opendaylight+Wireshark搭建SDN环境

Mininet+Opendaylight+Wireshark搭建SDN环境 折腾了一天,终于把SDN环境搭建完毕,最怕搭建实战环境了,每次都要折腾很久,网上的说明大部分都是一步执行成功,好佩服,基本上我都每个坑都跳,总结分享一下,以后少点弯路.最后感谢伟大的Google以及大神们的分享,期待后续SDN之旅. 本文用到的软件及其版本如下: FVMware Workstation 12.5.5 build-5234757 F Mininet镜像:mininet-2.2.2-170321-ubuntu

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

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

SEED Labs – Race Condition Vulnerability Lab

SEED Labs – Race Condition Vulnerability Lab 1Race Condition Vulnerability LabCopyright 2006 - 2016 Wenliang Du, Syracuse University.The development of this document was partially funded by the National Science Foundation under AwardNo. 1303306 and 1