【发布时间】:2017-12-22 15:50:11
【问题描述】:
我创建了一个规则,以便在连接到控制器时添加到打开的 vswitch。该规则允许 h1 与位于同一交换机上的 h2 通信。当与控制器的连接出现时,会添加以下规则。
event.connection.send(
of.ofp_flow_mod(action=of.ofp_action_output(port=1), priority=45,
match=of.ofp_match(dl_type=0x800, nw_dst="10.0.0.7")))
由于某种原因,流程将无法正常工作,但如果我将其更改为使用端口匹配,而不是使用 IP,它将起作用。由于有多个交换机,我不能只在端口上匹配。
起初我虽然可能 ICMP 不是 IPV4,但我确认它使用的是 Tcpdump。
sudo tcpdump -e -r tcpdump.pcap dst 192.168.0.103
reading from file tcpdump.pcap, link-type EN10MB (Ethernet)
14:24:30.940749 00:a0:98:ae:2c:fe (oui Unknown) > 00:1d:ec:0e:0b:fa (oui Unknown), ethertype IPv4 (0x0800), length 98: 192.168.0.112 > 192.168.0.103: ICMP echo request, id 1962, seq 1, length 64
网络由连接到 2 个叶交换机的主干交换机和每个叶交换机 2 台主机组成。
任何帮助将不胜感激。
def _handle_ConnectionUp(self, event):
#dpid = event.connection.dpid
# printing the dpid
# log.info("Switch with DPID of %s has come up.",dpid_to_str(event.dpid))
print("Switch with DPID of %s has come up." % (dpid_to_str(event.dpid)))
# printing the dpid in hex
# log.info("Switch with DPID in HEX format of %s has come up." % (hex(event.dpid)))
print("Switch with DPID in HEX format of %s has come up." % (hex(event.dpid)))
if event.dpid == 0x1:
event.connection.send(
of.ofp_flow_mod(action=of.ofp_action_output(port=2), priority=45,
match=of.ofp_match(in_port = 1)))
event.connection.send(
of.ofp_flow_mod(action=of.ofp_action_output(port=1), priority=45,
match=of.ofp_match(dl_type=0x800, nw_dst="10.0.0.1")))
【问题讨论】:
-
ARP 数据包可以从 h1 传输到 h2 并返回吗?如果你在h1上运行
arp,它是否知道h2的硬件地址? -
没有。不应该有流量意味着不再需要 arp 吗?
-
据我所知仍然需要 ARP。您的操作系统需要知道要在数据包中写入的硬件地址。回家后我会写一个完整的答案。
-
你是对的。一旦我配置了一个mac表,它就可以工作了。写一个答案并且不接受。谢谢您的帮助。当我将入口端口作为匹配项时,它的工作方式很奇怪。
-
很高兴我能帮上忙!我在下面发布了完整的答案。
标签: python sdn mininet openvswitch pox