Frenetic Python实验(一)

Follow:

Github-Frenetic

准备:

所有的实验,第一步都需要开启控制器,命令:

$ frenetic http-controller --verbosity debug

每一个实验,维护三个终端,一个控制器,一个mininet,还有一个用来跑你需要测试的应用。

实验1 drop_all

This application very simply drops all packets - the ultimate firewall!

目的:本次实验模拟极限防火墙,丢弃所有的包。

1.终端1:打开控制器:

2.终端2:Mininet Command:

sudo mn --topo=single,2 --controller=remote

3.终端3:

$ python -m frenetic.examples.drop_all.py

4.在终端2 Mininet中pingall,结果全部丢包:

mininet> pingall

实验2 Mac learning

This application implements a single L2 switch with an abitrary number of ports. It'll learn MAC addresses and selectively route traffic for those it knows about.

目的:模拟交换机mac学习的过程。这个应用脚本执行了一个二层交换机,同时有很多任意的端口,它会不断的学习mac地址,并根据它所学习到的内容进行路由选择和流量转发。

1.终端1打开控制器。

2.终端2打开mininet:

sudo mn --topo=single,10 --controller=remote

刚刚开始的控制器:

3.终端3执行应用脚本:

$ python -m frenetic.examples.learning

控制器信息:


4.在终端2里面pingall:

mininet> pingall

第一次pingall全部失败:

但是查看控制器,发现控制器学习了路由信息,不断设置流表:

终端3信息:

第二次pingall,交换机学习了部分路由信息:

第三次pingall,pingall成功率上升:

pingall in the Mininet window should yield 100% successfully sent packets. There will be a lot of Packet Out activity at first, but as MACs are learned the controller traffic should quiet down. Eventually the switch will handle all the traffic itself.

本实验模拟的是一个交换机不断学习mac的过程,因此,总有一天pingall会100%(摊手)。

2016/11/30

原文地址:https://www.cnblogs.com/qq952693358/p/6118919.html