1. Homepage
  2. Programming
  3. CAN201 Introduction to Networking - Lab 7 Building Network Topology with Mininet

CAN201 Introduction to Networking - Lab 7 Building Network Topology with Mininet

Engage in a Conversation
ChinaXJTLUCAN201Introduction to NetworkingBuilding Network Topology with Mininet

Lab 7 (Week 8) Building Network Topologywith Mininet

CAN201 Dr. Wenjun Fan CourseNana.COM

Outline • Introduction to Mininet • Mininet CLI commands • Build Custom Network Topology in Mininet • Lab Task (3 points) • Demo CourseNana.COM

Introduction to Mininet • Mininet: a virtual testbed used for testing network tools and protocols. CourseNana.COM

Attention: Mininet will be used in CW Part II ! CourseNana.COM

• Mininet offers the following features: o Fast prototyping for new networking protocols. o Simplified testing for complex topologies without the need of buying expensive hardware. o Realistic execution as it runs real code on the Unix and Linux kernels. o Open source environment backed by a large community contributing extensive documentation. CourseNana.COM

Introduction to Mininet • Install Mininet in Ubuntu: o $ sudo apt-get install mininet CourseNana.COM

• Test if it is installed successfully o $ sudo mn CourseNana.COM

Introduction to Mininet • The default minimal network topology CourseNana.COM

Mininet CLI commands • Command line interface: mininet> CourseNana.COM

• Command “help” shows the list of Mininet CLI commands and examples on their usage: Mininet> help CourseNana.COM

Mininet CLI commands • To display the available nodes, type the following command mininet> nodes CourseNana.COM

• To display the links to understand the topology, type the command mininet> net CourseNana.COM

Mininet CLI commands • Mininet allows you to execute commands on a specific device. To issue a command for a specific node, you must specify the device first, followed by the command. mininet> h1 ifconfig CourseNana.COM

Mininet CLI commands • Other Mininet CLI commands • To turn on a terminal of a node Mininet> xterm h1 CourseNana.COM

• To exit from the command line interface Mininet> exit CourseNana.COM

• Other Host shell commands • To clean up the Mininet network configuration $sudo mn -c CourseNana.COM

• To start the network with all terminals open $sudo mn -x CourseNana.COM

Build Custom Network Topology in Mininet • Mininet supports custom network topologies. • You can create a flexible topology (in Python) with just a few lines of code). Build Custom Network Topology in Mininet • Prepare the network topology python file on Linux $ vim myTopo_Lab7.py CourseNana.COM

Note: Press ‘i’ to enter INSERT mode. Add required content to the file. Press ‘esc’ to enter NORMAL mode. Use ‘ZZ’ to write your changes and exit vim. CourseNana.COM

Build Custom Network Topology in Mininet • Import Mininet Python library CourseNana.COM

#/usr/bin/python
from mininet.net import Mininet
from mininet.cli import CLI
from mininet.node import Host
from mininet.node import OVSKernelSwitch
from mininet.log import setLogLevel, info

Build Custom Network Topology in Mininet • Define a function myTopo() to constitute all the nodes and links. • The Mininet class returns an empty network object to which we add hosts, switches etc. CourseNana.COM

def myTopo():

net = Mininet( topo=None, autoSetMacs=True, build=False, ipBase='10.0.1.0/24')

Build Custom Network Topology in Mininet • Add hosts and switch CourseNana.COM

h1 = net.addHost( 'h1', cls=Host, defaultRoute=None)
h2 = net.addHost( 'h2', cls=Host, defaultRoute=None)
h3 = net.addHost( 'h3', cls=Host, defaultRoute=None)
s1 = net.addSwitch( 's1', cls=OVSKernelSwitch, failMode='standalone')

Build Custom Network Topology in Mininet • Add links CourseNana.COM

net.addLink(h1, s1)
net.addLink(h2, s1)
net.addLink(h3, s1)

Build Custom Network Topology in Mininet • Assign IP addresses to interfaces of hosts CourseNana.COM

h1.setIP(intf=“h1-eth0”,ip=‘10.0.1.2/24’)
h2.setIP(intf=“h2-eth0”,ip=‘10.0.1.3/24’)
h3.setIP(intf=“h3-eth0”,ip=‘10.0.1.4/24’)

Build Custom Network Topology in Mininet • Network build and start net.build() net.start() CourseNana.COM

• CLI mode running CLI(net) net.stop() CourseNana.COM

Build Custom Network Topology in Mininet • Add the main function to the python program if name == ‘main’: setLogLevel( ‘info’ ) myTopo() CourseNana.COM

Build Custom Network Topology in Mininet • Save the python file and quite vim • Run the network topology python file $sudo python3 myTopo_lab7.py CourseNana.COM

Lab 7 Task (3 points, DDL Nov.8th Tues. 23:59) CourseNana.COM

  1. Walk through this lab, in particular, learn how to customize network topology with Mininet in Python.
  2. Create network topology python file in terms of the following figure. Host 2 10.0.0.3/24

Host 1 Switch 1 CourseNana.COM

10.0.0.2/24 CourseNana.COM

Host 3 CourseNana.COM

10.0.0.4/24 CourseNana.COM

  1. Name the python file: myTopo_lab7.py, and submit it to the assignment on LMO.

Demo CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
China代写,XJTLU代写,CAN201代写,Introduction to Networking代写,Building Network Topology with Mininet代写,China代编,XJTLU代编,CAN201代编,Introduction to Networking代编,Building Network Topology with Mininet代编,China代考,XJTLU代考,CAN201代考,Introduction to Networking代考,Building Network Topology with Mininet代考,Chinahelp,XJTLUhelp,CAN201help,Introduction to Networkinghelp,Building Network Topology with Mininethelp,China作业代写,XJTLU作业代写,CAN201作业代写,Introduction to Networking作业代写,Building Network Topology with Mininet作业代写,China编程代写,XJTLU编程代写,CAN201编程代写,Introduction to Networking编程代写,Building Network Topology with Mininet编程代写,Chinaprogramming help,XJTLUprogramming help,CAN201programming help,Introduction to Networkingprogramming help,Building Network Topology with Mininetprogramming help,Chinaassignment help,XJTLUassignment help,CAN201assignment help,Introduction to Networkingassignment help,Building Network Topology with Mininetassignment help,Chinasolution,XJTLUsolution,CAN201solution,Introduction to Networkingsolution,Building Network Topology with Mininetsolution,