0

コントローラーに接続するときに、開いている 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")))
4

1 に答える 1