基础要求
tcpdump 验证Hub模块
h1 ping h2的tcpdump抓包结果截图
h1 ping h3的tcpdump抓包结果截图
tcpdump 验证Switch模块
h1 ping h2的tcpdump抓包结果截图
h1 ping h3的tcpdump抓包结果截图
L2_learning模块代码流程图
进阶要求
代码
from pox.core import core
import pox.openflow.libopenflow_01 as of
from pox.openflow.of_json import *
class SendFlowInSingle3(object):
def __init__ (self):
core.openflow.addListeners(self)
def _handle_ConnectionUp(self, event):
msg = of.ofp_flow_mod()
msg.priority = 1
msg.match.in_port = 1
msg.actions.append(of.ofp_action_output(port=2))
msg.actions.append(of.ofp_action_output(port=3))
event.connection.send(msg)
msg = of.ofp_flow_mod()
msg.priority = 1
msg.match.in_port = 2
msg.actions.append(of.ofp_action_output(port=1))
msg.actions.append(of.ofp_action_output(port=3))
event.connection.send(msg)
msg = of.ofp_flow_mod()
msg.priority = 1
msg.match.in_port = 3
msg.actions.append(of.ofp_action_output(port=1))
msg.actions.append(of.ofp_action_output(port=2))
event.connection.send(msg)
def launch():
core.registerNew(SendFlowInSingle3)
运行结果
个人总结
个人感想
实验遇到的问题
(1)一直能ping通