SDN第二次上机作业
1、安装floodlight
参考链接:http://www.sdnlab.com/19189.html
2、生成拓扑并连接控制器floodlight,利用控制器floodlight查看图形拓扑。
代码如下:
from mininet.topo import Topo
class MyTopo(Topo):
def __init__(self):
# initilaize topology
Topo.__init__(self)
# add hosts
host1 = self.addHost('h1')
host2 = self.addHost('h2')
host3 = self.addHost('h3')
# add switches
switch1 = self.addSwitch('s1')
switch2 = self.addSwitch('s2')
switch3 = self.addSwitch('s3')
switch4 = self.addSwitch('s4')
# add links
self.addLink(host1, switch2, 1, 1)
self.addLink(switch2, switch1, 2, 1)
self.addLink(host2, switch3, 1, 1)
self.addLink(switch3, switch1, 2, 2)
self.addLink(switch1, switch4, 3, 1)
self.addLink(switch4, host3, 2, 1)
topos = {'mytopo': (lambda: MyTopo())}
生成的拓扑图
3、利用字符界面下发流表,使得‘h1’和‘h2’ ping 不通
参考链接:http://www.sdnlab.com/19394.html
- 拓扑连通性截图