Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
21 views23 pages

SDN Lab Assignment

The document discusses the use of Mininet for educational purposes in networking, emphasizing its ability to simulate network topologies. It includes instructions for setting up a POX controller and implementing firewall rules using Python scripts. Additionally, it outlines hardware and software requirements for running the simulations effectively.

Uploaded by

andy899972
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
21 views23 pages

SDN Lab Assignment

The document discusses the use of Mininet for educational purposes in networking, emphasizing its ability to simulate network topologies. It includes instructions for setting up a POX controller and implementing firewall rules using Python scripts. Additionally, it outlines hardware and software requirements for running the simulations effectively.

Uploaded by

andy899972
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 23
Prochtal -1 Jitle 8 Demonstrate Hae basi erulute dibterend Cuda "a Ti ; wea ; 4 ia Mininet_ase__ Che Jl switches Minine__is cone used aio learning tral_to lett, expeni-— ent. and lew ‘about _4 Sal. bNininel is preferable —__ becaude 14 i way foal and _fps_us_fo_cotabe(uatoeninable — topolopies U 4s “alsa vee oy douse. FOR EDUCATIONAL USE -line he__minin ommund Line is Similar ty tha 0 You Linu ommend bine sia a interna with _ Ye _ Sim, = dopale gy ost agle singh itch and Linear _tepakgy - dapat wher each —_ gwnitch has one hos an oll widthex connect in _o in doutkep = dt applications that — ase ig Quen Jon _grmtrecals ———— By Dr can_be__used pinout programming cllso. 11 _dlso__givea__ ua Ha —peaty to adey rede — pln ___ Aer Hoare log —paving way hor cea and | expenscoenting wait poate a alealy us to bedebuy oy un networks FOR EDUCATIONAL USI ‘Dawa load fi box Download _TNininet and ex! ay chick on” Start’ ay ®Dewole- chick cate ovl ile and 0 | ie file y afd pith crednhabs — Conclusion 2 Ann : —passuocrd i _minine+ _ Sulo, ep installed and an attwertly +o FOR EDUCATIONAL USE 7 Ye Ee rh es ieraarye tn rg eminem Bi vos pas Peruana eee Deane eet eee aC TZ eee eC ere ees a eer ST Sez te? pee Ptr neyare sen ioe Poneto eane) iinet cee 3 Pec areeeCORLD peemecrtatr mnie pee mans oed peeCCeure ese pea Ceurim ens Cleese mesa) SeeRCceC tat ms ard ey eae ey eee RCs — pera aatr mong Dyarucos eae Pee eee eae ee ee Pa Pa Aare ro] iieamd 0 Pen aarets cee tes ey cred SUreSecTe corey a Pee ea eee uo should work Sone character-oriented interactive commands Pe eee ee ce ere arcs cary pores JL Puchi cal 2. —__ ewa tml ——wing Ha _Stove__camponentis had |. come _\undltd with POX conta lee | ____ Pax pmvider 4 framework jet __ceatmunitahing ait —_|l SON nusiddaea using _eithes Vat Oson laa ee | OVSOB __emtacol. _ Dendlooor: con use Por ho | citute. _un __soal controle ping Hau Py Mano — — pt pmo coming aap SEE POX cun_be_imme diately __uaed ato _bagic__ SDN FOR EDUCATIONAL USE dw POX console is _Yar__Aerminall session {ana — luli we cia tun te POX __contomlle Mini Ed’t — an emulated Detwdese lx made. aod Linu 2. hosds. | Linear pee fog yo ype hatt—tpsigy —in—tahh—all-leh—in wean connected by _noe _nehusatls cahle in \ineut —_ Mannet._ HRinaaacah it FOR EDUCATIONAL USE Ould Hw etroale 8 \y_£oalole SSH_pott _fonwurding on Mioingt vera BY Session 4: i} open miniedit * | Host 2 =P caddro: >_10:0-0-2 ay Gession 2 * iy Run POK otmnller. ~. ing. £2 — ii) Go to miniedit omdouw Click "Run" ie} botteny commen ith Ace 06 Ings an _Gession 9 terminal windwo __ Conclusion £ : remote _condnp\ler. a oo i = as —— il x File Edit Run Help = POX Controller o Switches .s hl | Linux Hosts h2 Drachicall 3 Regucremenfs = wirdware = Compule with 4G RAM, G0 Rord boric Bs Gi ptocessot Soltware -— Mining! vel. PT TY, POx_conimller Sirewall — divewali's are __adlucale —seculy 8 _Syslem ar —- prtuent —_unautaosized. access. — o_o _nefweonla___T4__con__ bea _Inardypove __o7 Software, unit thal ~ Hes the os FOR EDUCATIONAL USE ~ FOR EDUCATIONAL USE © Firewall.py from poxcore import core from poxlia.uti import dpiaToSte import poxopentlow libopenflow_O1 2s of from pox.lio,packetethernet import ethernet log = core.getlogger() tadle firewall = (} def AddRule (event, dl_type=0x800, nw_prote firewall{(event.connection dl_type.nw_proto,port.sre_port}|=True log.debugl"Adding firewall rule to %s: s %6s 4s %s" % dpidToStrievent.connection.dpid), dl_type, nw_proto, port, sr¢_port) port=0, sre_port f.OFPP_All} DeleteRule (event, ty del firewall(event connection %s.5i" % (packet src, eventofp.in_port, packet.dst, of OFPP_ALL)) eke: msg = of.ofp_flow_modl) msgmatch.dl_type = packet.dl_type msgmatch.nw_proto = packet-aw_proto if (n¥_proto I= 1} msgmatchp_src = packet tp_sre msgmatch dl_dst msgimatch.dl_sre = packet dst msgidie_timeout = 10 msghard_timeout = 30 msg.actions.aapend(of.ofp_action_output{port = event port) ‘msg send{event.connection) acketsre msg = of ofp_flow_modl) msgmatch.di_type = packet.dl_type msgrmatch.nw_proto = packet.nw_proto if (nw_proto I= 1) msgimatchtp_sre = packet.p_sre msgmatch.dl_sre = packet src msgmatch.dl_dst = packet dst msgidie_timeout = 10 msghard_timeout = 30 msgactions.append(of ofp_action_output(port = dst_port}), msg send{event.connection, resend = event ofp) log.debug{"Instaling 945.9 > %s.56i AND 5.56 > 96.6" 96 (packet dst, dst_port, packetsrc, eventofp.in_port, packetsrc, event ofp.in_port, 6 5, dst_port)) def launch (): core.cpentlow.addlistenerByName(" core-opentlow.addlistener ByName(" ‘onnectionUp", _handle_StartFirewall) acketin’, handle Packetin) * Tree.py Trom pox.core import core import poxopentlowlibopenflow_01 as of log ore getlogger() class Tutorial (object) def _ init__(self, connection} self connection = connection connection.addlisteners self_mac_to_port = def send_packet (self, buffer_id, raw_data, out_port, in_port): msg = of ofp_packet_out() msgin_port = in_port if butfer_id |= -1 and butfer_id is not None: msg.buffer_id = buffer_id else! if raw_data is None: msg.data = raw_data action = of ofp_action_output{por ‘msg.actions.append{action) self.connection.send{mse) ut_port) def act_like_hub (self, packs log.debugi*installing flow for %s.9i > 965.96" Selpacket.src, packet_in.in_port, packetdst, of OFPP_FLOOD}) msg = of ofp_flow_mod) msgmatch = of.ofp_match from_packet(packet) rmsgidie_ timeout = 10 msghard_timeout = 30 ‘msgaactions.aapend|of.ofp_action_output{port = of OFPP_FLOOD}) msgbuffer_id = packet_in.buffer_id self connection sendimse) def act_like_switch (self, packet, packet_in} sell.mac_to_port[str(packet.st¢}] = packet_inin_port if str(packet.dst) in self mac_to_por port = selfmac_to_port{stripacket dst] Jog.debugt"installing flow for %s.%i > 9.94 msg = of.ofp_flow_mod) msgimatch.dl_ést = packet. dst rmsgmatch ol_sre = packet sre msgidle timeout = 10 rmsg.hard_timeout = 30 imsg.actions.append{of.ofp_action_output(port = port}) msg.buffer_id = packet_in.buffer_id self.connection sena(mse) Sé{packet src, packet_in.in_port, packet.dst, port)) else: selfsend_packet(n ft_in buffer_id, packet_in-data.of OFPP_FLOOD, packet_in.in_port) def _handle_Portstatus (sel, ev if eventadded: log.debugl"HW Address %s to port 9d added (3d) elif event deleted: log.debug|"Port Sd deleted (s4d).",event.port, event.dpid) jevent.ofp.deschw_addr, event.port, event.dpid) det _handle_Packetin (self, event) if not packet parsed: log.warning("ignoring incomplete packet") return self.act_like_switch{packet, packet_in) def launch (): def start_switch (event): log.debugi*Controlling Xs" % (event.connection,}) Tutorial{event. connection) coreopentlow.addlistenerByName("ConnectionUp", start_switch} L _ Practical 4 prcess Ye —_parlreh _forucadli interJace. You must checlr tu. ~ etherned ‘and fwaediy Logi is Cael fo puikels goto] Reqyirement Hawlwore — Computer with 4G RM, 108 sora ! _preehee__ | Software = PMinines Ur, POX contmiler . PyTTY 4p __so}turart aldwetk vivtuslixodion —can combine multiple pls oho 4s ane virtual, psuoocre posed —nebacs oni con -divide.__one pysical network into separate dependent —virtuck {I prefeoor bey. $$ FOR EDUCATIONAL USE £+her nef i ot td _totoudes _Nhinen vin g eclnno logics commonly d A Oca x Aetwo g eta politan nekwod aad de__ox Nehwor An ethernet frome is. des 2 nk ~pte 4 Link. unit gad uses a. _uunderyi nd bysital luge. tauns mechaniso: Tater net paotecol — Axteanel_—prmt tol (FP) ig Wa Method ot __pazstoco , wWieh dado. ext {oman __one _cmenpute to _unsHlaeh _o Ye _integneb 1 A rouleh is __@ i ox virtual = She passed ajpimation me Awe onset oar 0 ye a epalen neon Yowting tole — od : : - A souding Ankle ig a data toble stored _ia A MA HA tes t portiynlar Lo netudens ho ceemais at FOR EDUCATIONAL USE Stan ta follows to__build _intemnet amuter © tee Mining p Swit \ - . : ! iF t——— 2 hs i) © Router.py from pox.core import core import poxopentlowlibopenflow_01 as of class RouterController(object) def _ init__{self core.openflow.addlisteners(self) def _handle_Packetin(self, event ing rules tion.eth_adér f Define the ro% ifevent.conni # Forward packets 100:00:00:00:00:01 fom host 1 to host 2 actions = [of.ofp_action_output(port=2)] elf event.connection.eth_addr == "00:00:00:00:00:02" 4 Forward packets from host 2 to host 1 actions = [of.ofp_action_output(port=1) # Flood packets to all ports actions = [of.ofp_action_output(port=of OF PP_FLOOD) packet out ft Send }¢ appropriate port(s} out = of ofp_packet_out{data=eventofp, action=actions) event.connection.send(out) launch} 4 Start the router controller core registerNew(RouterController) File Edit View Go Capture Analyze Statistics Telephony Tools Internals Help ©COMm dA SNXeic e¢Rera BH - — as ono on > Frane 23198: 191 bytes on wire (1528 bits), 191 bytes captured (1528 bits) on interface 8 > Ethernet IL, Sre: CadmusCo_3d:c?:96 (08:00:27:34:c?:96), Dst: CadmusCo 83:00:42 (88:00:27:0| Internet Protocol Version 4, Src: 192.168.56.101 (192.168.56.181), Dst: 192,168.50.102 (192 ‘Transmission Control Protocol, Src Port: 6633 (6633), Ost Port: 41304 (41304), Seq: 60876, > OpenFlow <——_—— | Jo0ee 98 00 27 03 00 42 a8 0 27 34 7 96 08 00 45 00 Joo18 99 bI 25 57 40 68 49 06 22 d4 CO a8 38 65 CB aB Jooze 36 66 19 €9 a1 50 2a 29 91 bi OO cd 5d Sf 08 18 Joo3e 95 ac ds 41 06 09 01 01 hl }© te [etho:

You might also like