【问题标题】:Modifying IP and MAC-addresses in an OpenFlow-enabled Network在启用 OpenFlow 的网络中修改 IP 和 MAC 地址
【发布时间】:2014-07-16 09:29:44
【问题描述】:

我有一个这样的虚拟网络:

http://imgur.com/wjPf2AG

交换机为Open VSwitch,全网由Big Switch Floodlight控制器控制。

我正在尝试为 switch1 设置两个流:

1) 捕获从 h1 到 h2 的任何数据包,并将它们的 dst-IP 和 dst-MAC 地址更改为 h3 的地址。

2) 捕获从 h3 到 h1 的任何数据包,并将它们的 src-IP 和 src-MAC 地址更改为 h2 的。

(查看问题底部的确切 Floodlight REST API 请求)

所以当我从 h1 ping h2 时,ping 应该转到 h3 并返回,但到目前为止我还没有成功。

这可以吗?如果是这样,我错过了什么?提前致谢!

迷你网设置:

sudo mn --topo single,3 --controller remote

Floodlight REST API 请求:

查找IP和MAC地址并用jq解析:

curl localhost:8080/wm/device/ | jq '.[]|{mac,ipv4}'

设置第一个流(注意,如果你自己尝试,MAC地址可能不同):

curl -d '{"switch": "00:00:00:00:00:00:00:01", "name":"redirection", "src-ip":"10.0.0.1", "dst-ip":"10.0.0.2", "src-mac":"7a:b9:87:ee:d2:b7","dst-mac":"a6:77:bf:8f:c4:db", "ether-type":"0x0800","active":"true","actions":"set-dst-ip=10.0.0.3,set-dst-mac=c2:65:e3:d3:6c:11"}' localhost:8080/wm/staticflowentrypusher/json

设置第二个流程:

curl -d '{"switch": "00:00:00:00:00:00:00:01", "name":"redirection2", "src-ip":"10.0.0.3", "dst-ip":"10.0.0.1", "src-mac":"c2:65:e3:d3:6c:11","dst-mac":"7a:b9:87:ee:d2:b7", "ether-type":"0x0800","active":"true","actions":"set-src-ip=10.0.0.2,set-src-mac=a6:77:bf:8f:c4:db"}' http://localhost:8080/wm/staticflowentrypusher/json

【问题讨论】:

    标签: networking ping openflow sdn virtual-network


    【解决方案1】:

    每个 OpenFlow 规则都有一个匹配项和一个操作。您需要为符合您的规则的数据包指定操作。

    【讨论】:

      【解决方案2】:

      您的流没有指定任何转发操作(即“输出:2”)。因此,Mac/IP 在数据包中被修改,然后数据包被交换机丢弃。 OVS 是一个简单的 openflow 交换机,不做任何传统的交换/路由。

      为了让您的流程实现您想要实现的目标,您需要指定一个输出操作,如下所示:

      curl -d '{"switch": "00:00:00:00:00:00:00:01", "name":"redirection", "src-ip":"10.0.0.1", "dst-ip":"10.0.0.2", "src-mac":"7a:b9:87:ee:d2:b7","dst-mac":"a6:77:bf:8f:c4:db", "ether-type":"0x0800","active":"true","actions":"set-dst-ip=10.0.0.3,set-dst-mac=c2:65:e3:d3:6c:11,output=2"}' localhost:8080/wm/staticflowentrypusher/json
      

      其中 2 是连接所需主机 (10.0.0.3) 的端口 ID。

      【讨论】:

        猜你喜欢
        • 2011-07-07
        • 1970-01-01
        • 2014-09-22
        • 2019-02-03
        • 2013-03-31
        • 2016-11-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多