我创建了一个规则,以便在打开的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")))发布于 2017-12-22 20:29:12
在典型的L2网络中,两个主机需要与ARP协议通信以交换硬件地址,然后才能互相ping (或任何其他基于IP的协议)。
我最好的客户是,使用您当前的配置,h1可以向h2发送一个ARP请求(这要感谢入口端口上的规则),但是h2不能回答。因此,h1不知道h2的硬件地址,无法发送IP数据包。要验证这一假设,您可以运行:
$ arp
Address HWtype HWaddress Flags Mask Iface
10.0.0.7 (incomplete) eno1
10.0.0.254 ether 00:00:00:00:00:08 C eno1例如,在这里,10.0.0.7的地址是未知的。
您至少有两个解决方案:
arp -h。https://stackoverflow.com/questions/47944124
复制相似问题