设为首页 收藏本站
查看: 684|回复: 0

[经验分享] SDN in Action: Build a mini

[复制链接]

尚未签到

发表于 2018-6-3 10:08:30 | 显示全部楼层 |阅读模式
  SDN in Action: Build a mini-lab environment and practice SDN-IP/ONOS with GNS3, Mininet and VMware

  
  薛国锋  xueguofeng2011@gmail.com
  

  本文主要通过简单的实验,对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:
DSC0000.png

  
  Physical topology and connections:

   DSC0001.png
  Logical network topology and connections:

   DSC0002.png
  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.
DSC0003.png

  

  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
   DSC0004.png
  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
DSC0005.png

  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:
   DSC0006.png
  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
   DSC0007.png
  
  

  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.

   DSC0008.png
  
  

  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:
DSC0009.png

  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.

   DSC00010.png
  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.

  

   DSC00011.png
  

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

  sudo  gedit/etc/network/interfaces  

   DSC00012.png

  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.
  

   DSC00013.png
  
  

  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:
   DSC00014.png
  
  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:
DSC00015.png

  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 ).

   DSC00016.png
  
  You can try some CLIs in ONOS:

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

   DSC00018.png
  

  
  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 ?
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-508628-1-1.html 上篇帖子: 关于vmware 5.5和vmware6.0 修改 vsphere client 登陆名字 下篇帖子: VMWARE VCSA 6.5安装过程
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表