[英]Pox proactive openflow rule
我創建了一個規則,以在連接到控制器時將其添加到打開的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")))
在典型的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
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.